Last post Aug 12, 2008 02:05 AM by mariuchp
Aug 11, 2008 03:13 PM|mariuchp|LINK
Hello, How can I use dynamic generated table on ASP NET mobile web page? I have data from database and I need at least three columns. Most new mobilephone browsers (standard xhtml-mobile10) support tables. I can use <table> tags between <mobile:DeviceSpecific>
tag, but I 'd like to generate dynamic table, so I need something like Response.Write("<table>"). Unfortunately it doesn't work. :( . Please HELP!! (sorry Imy english isn't perfect)
Aug 11, 2008 09:56 PM|irtizaur|LINK
i can give you an example that works fine on most of the phones but its not in mobile web form.
the idea is, replace the pages that your are going to use dynamically generated controls (like table here) with basic xhtml pages. display will reamin same but the page form is different.
like if your page is Mobile.aspx refer it with xMobile.aspx and make the page as your requirements.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="xMobile.aspx.cs" Inherits="xMobile"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<form id="form1" runat="server">
<% CreateTable(); %>
public partial class xMobile : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
public void CreateTable() /// create your table dynamically here
Response.Write("<table><tr>"); /// single row data
for (int i = 0; i < 3; i++)
Response.Write("Column No: " + (i + 1) ); /// Column data
and don't forget to use ContentType="text/html" on the page directives.
hope it will help...
Aug 12, 2008 02:05 AM|mariuchp|LINK
Thanks very much, It's good solution, but I have anather. I think that define my own Mobile Web User Control will fix the problem. Next I can use <%= > tags to run script.
But I have another problem. How to create user control to show html text after using DataBind() function. When I use <%=> It always run when page_load, but I want later.