how to add a new row in a grid at runtime
ASP.NET
1
Posts
1
Posters
0
Views
1
Watching
-
using a grid i have created two rows by binding the hidden template field with a datasource in pageload event, Now i have to Add a new row in the grid using a button click....maitaining the values in the textbox in the grid entered by user.... ========================= <%# Eval("ROW") %> coding in page_load event is =================================== protected void Page_Load(object sender, EventArgs e) { Addrow(dgLocsch, 2); } private void Addrow(DataGrid dg, int NoOfRows) { DataTable dt = new DataTable(); dt.Columns.Add("ROW"); for (int i = 1; i <= NoOfRows; i++) { DataRow dr; dr = dt.NewRow(); dr["ROW"] = i.ToString(); dt.Rows.Add(dr); } dg.DataSource = dt; dg.DataBind(); } can any one help me......
thank u