private void SetInitialRow()
{
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add(new DataColumn("RowNumber", typeof(string)));
dt.Columns.Add(new DataColumn("Column1", typeof(string)));
dt.Columns.Add(new DataColumn("Column2", typeof(string)));
dt.Columns.Add(new DataColumn("Column3", typeof(string)));
dr = dt.NewRow();
dr["RowNumber"] = 1;
dr["Column1"] = string.Empty;
dr["Column2"] = string.Empty;
dr["Column3"] = string.Empty;
dt.Rows.Add(dr);
//Store the DataTable in ViewState
ViewState["CurrentTable"] = dt;
Gridview1.DataSource = dt;
Gridview1.DataBind();
}
Dynamic DataTable in ASP.NET
Subscribe to:
Comments (Atom)
Search This Blog
Tags
Popular Posts
-
Some time when you bind gridview ,you can find some duplicate rows in that grid, by this underlying piece of code you can easily avoid (or...
-
#region " Declare All " DataTable dtPrint = new DataTable(); // Create Table object ...
-
http://www.refulz.com:8082/index.php#tab2?foo=789 Property Result ------------------------------------------- host www.refulz...
