Home > C# Code Examples > PopulateHTMLTable()

PopulateHTMLTable()


public void PopulateHTMLTable()

{

    int numrows = 5;

    int numcells = 7;

    for (int j = 0; j < numrows – 1; j++)

    {

        HtmlTableRow r = new HtmlTableRow();

        for (int i = 0; i < numcells – 1; i++)

        {

            HtmlTableCell c = new HtmlTableCell();

            c.InnerHtml = “Created from” + Environment.NewLine + “code behind”;

            //c.Controls.Add(new LiteralControl(”row ” + j.ToString() + “, cell ” + i.ToString()));

            r.Cells.Add(c);

        }

        this.Table1.Rows.Add(r);

    }

}

Advertisements
Categories: C# Code Examples
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: