Click here to Skip to main content
14,775,752 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used a datalist control in which i added a gridview template with three columns.
In datalist 2 rows are there that means two gridviews.

Now i want to add rows dynamically in gridview of first row.

How can i do this

Thank you,

1 solution

DataTable dt = new DataTable();
//this is used to add columns in the database, means columns in your GridView
dt.Columns.Add(new DataColumn("column_name", typeof(string)));
//this is used to initialise datarow
DataRow Dr = dt.NewRow();
//specify column value
Dr["column_name"] = "column_value";
//now you are adding a row in the datatable along with value(s) you specified.
GridView1.DataSource = dt;
Anuja Pawar Indore 19-Jan-12 4:34am
Added pre tag
Jagadeesh Bollabathini 19-Jan-12 4:35am
in which datalist row gridview you are adding this row.
Shailesh g 21-Jan-12 4:23am
With the code i am adding row in GridViw1. Let me know what and how you want.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900