how to create an html table from server side in 2.0

Posted on 2007-07-25
Last Modified: 2008-01-09
I have a web page and in that i want to display all the records from a table in a tabular form on the web page and i donot want to use datagrid control

but i donot want to write any server side coding on the html part.
so how can i create a html table from the server side and them add it to the html part at runtime.
Question by:ziorrinfotech
    LVL 9

    Accepted Solution

    You can create object of HtmlTable in your server side code. And on the aspx page you can place a asp:panel object. So that on server-side code when you have prepared the HTMLTable you can directly write aspPanelObject.Controls.Add(HTMLTableObject). This will render your HTML Table on your aspx page at runtime.

    For more Information see the link below:


    Chirag Patel
    LVL 5

    Assisted Solution

    you can construct your table on the server side with the System.Web.UI.WebControls.Table. just add rows and cells to it. here is an example you can get a bit idea from it. after you table have all the rows and cells, you can append that to a location on the form. if you data is in a datatable, you can use GridView or DataGrid to display that in a table. here is a good article on using grid

    // example in C#
             Table tbl = new Table();
             TableRow row;
             TableCell cell;
             TextBox txt;
             cell = new TableCell();
             cell.Text = "Name:";
             row = new TableRow();
             txt = new TextBox();
             txt.Text = "Robot";
             cell = new TableCell();

             cell = new TableCell();
             cell.Text = "Company Name:";
             row = new TableRow();
             txt = new TextBox();
             txt.Text = "The Machine Company";
             cell = new TableCell();
             tbl.GridLines = GridLines.Both;
             tbl.CellPadding = 0;
             tbl.CellSpacing = 0;
             tbl.Width = Unit.Percentage(100);

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now