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 comment