System.Exception:MobileControl必须包含在MobilePage:ASP.webform1_aspx中

时间:2010-08-07 07:54:47

标签: asp.net controls mobile

您好我在asp.net中运行移动表单页面时收到此异常。它的脚本是:

    <mobile:Label id="lblCriteriaA" runat="server">Hi all</mobile:Label>
    <mobile:Label id="lblCriteriaB" runat="server"></mobile:Label>
    <mobile:SelectionList id="slstMovies" runat="server"></mobile:SelectionList>
    <mobile:Command id="bttnSubmit" runat="server" OnClick="showData">Show Times</mobile:Command>
    <mobile:TextView ID="TextView1" Runat="server">TextView</mobile:TextView>

<mobile:Label id="lblCriteriaA" runat="server">Hi all</mobile:Label> <mobile:Label id="lblCriteriaB" runat="server"></mobile:Label> <mobile:SelectionList id="slstMovies" runat="server"></mobile:SelectionList> <mobile:Command id="bttnSubmit" runat="server" OnClick="showData">Show Times</mobile:Command> <mobile:TextView ID="TextView1" Runat="server">TextView</mobile:TextView>

这个设计脚本有什么问题吗?如果我想在服务器端编写代码呢?

1 个答案:

答案 0 :(得分:1)

您的服务器控件似乎不在标记内。

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication_ASPMobile.WebForm1" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %>

  <mobile:Form id=Form1 runat="server">

     <mobile:Label id="lblCriteriaA" runat="server">Hi all</mobile:Label>
     <mobile:Label id="lblCriteriaB" runat="server"></mobile:Label>
     <mobile:SelectionList id="slstMovies" runat="server"></mobile:SelectionList>
     <mobile:Command id="bttnSubmit" runat="server" OnClick="showData">Show Times</mobile:Command>
     <mobile:TextView ID="TextView1" Runat="server">TextView</mobile:TextView>
  </mobile:form>