Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to add rows in gridview using datatable


My gridview as follows


Room Course Room Course Room Course





i want to add rows manually in gridview.i want the Room no maually in gridview as show below in my ouput as follows.

Output as follows in gridview;

Room Course Room Course Room Course

11 21 31

12 22 32

13 23 33

14 24 34


for getting a above output in gridview.how can i do?

please help me.

Regards,
narasiman P.
Posted
Comments
Savalia Manoj M 4-Jul-13 9:30am    
Have you try anything??
Please write your code if you try..

DataTable dt = new DataTable();
dt.Columns.Add("Room Course ");
dt.Columns.Add("Room Course ");
dt.Columns.Add("Room Course ");

Add value to data table:

dt.Rows.Add(11,21,31);
dt.Rows.Add(12,22,32);
.
.
And bind you grid view:
GridView1.DataSource = dt;
GridView1.DataBind();

If this one help to you accept as answer and vote pls.
 
Share this answer
 
v2
 
Share this answer
 
v2

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