2010-08-07 55 views
1

您好,我在運行asp.net中的移動窗體頁時遇到了這個異常。其腳本是: System.Exception:MobileControl必須包含在一個MobilePage中:ASP.webform1_aspx

<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

看起來你的服務器控件不在標籤內。

<%@ 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> 
+0

嗯......好的!但那劇本應該怎樣? – 2010-08-07 09:49:41

+0

這不會工作親愛的,它需要MobileForm作爲容器標籤,而不是正常的形式標籤。 – 2010-08-07 11:16:03

+0

正在工作...............!但是一定是這個,這個aspx的代碼必須從「System.Web.UI.MobileControls.MobilePage」繼承。 – 2010-08-13 12:24:29

相關問題