如何使用datatable手动添加gridview中的行
如何使用数据表在gridview中添加行
我的gridview如下
房间课程房间课程房间课程
i希望在gridview.i中手动添加行。想要在我的输出中如下所示在gridview中没有实际的房间,如下所示。
在gridview中输出如下;
房间课程房间课程房间课程
11 21 31
12 22 32
13 23 33
14 24 34
在gridview中获得以上输出我可以吗? b $ b
请帮帮我。
问候,
narasiman P.
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.
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.
TRY这... :)
如何在C#,ASP.NET中以编程方式创建DataTable? [ ^ ]
TRY THIS...:)
How to Create DataTable Programmatically in C#, ASP.NET ?[^]