Skip to content
July 16, 2009 / kiranpatils

How to use asp:table in Mobile Page

Challenge:

How to use asp:table in Mobile Page?

Or if you got an error

‘asp:Table’ cannot be a top-level form element.

Then solution is here:

Solution:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Mobile2.Default1" Codebehind="Default1.aspx.cs" %>

<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<html xmlns="http://www.w3.org/1999/xhtml" >

<body>

<mobile:Form id="Form1" runat="server">
<mobile:panel id="pnlMobile" runat="server">
<asp:Table id ="mainTable" runat="server">
<asp:TableRow>
<asp:TableCell>
<mobile:Label ID="Label1" runat="server">Demo</mobile:Label>
</asp:TableCell>
<asp:TableCell>
<mobile:Label ID="Label2" runat="server">Demo</mobile:Label>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</mobile:panel>
</mobile:Form>
</body>
</html>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: