. Aspx file:
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "t1.aspx. cs" inherits = "T1" %>
<! 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">
<Head runat = "server">
<Title> No title page </title>
</Head>
<Body>
<Form method = "Post" runat = "server">
<Asp: Label style = "Z-INDEX: 101; left: 41px; top: 33px" runat = "server"> Asp. net table control dynamically generates table operation instances </ASP: Label> & nbsp;
<Asp: Table Style = "Z-INDEX: 104; left: 35px; top: 89px "runat =" server "gridlines =" both "bordercolor =" # ffc080 "borderstyle =" dotted "borderwidth =" 1px "cellpadding =" 0 "cellspacing =" 0 "Height = ""153px" width = "344px">
</ASP: Table>
</Form>
</Body>
</Html>
. CS file:
Using system;
Using system. Data;
Using system. configuration;
Using system. collections;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Public partial class T1: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
Int I, J;
For (I = 0; I <6; I ++) // 6 rows
{
Tablerow ROW = new tablerow ();
For (j = 0; j <4; j ++) // 4 columns
{
Tablecell cell = new tablecell ();
Cell. Text = "column =" + J. tostring ();
If (j = 3) // Add button control in column 4th
{
Button btna = new button ();
Btna. Text = "column = 3 ";
Cell. Controls. Add (btna );
}
Row. cells. Add (cell );
}
Table1.rows. Add (ROW );
}
}
}
: