把集合的值赋值给datatable
用循环怎么写把集合的值放到datatable中再绑定datagrid!! --------------------编程问答-------------------- 给点分嘛,哎 --------------------编程问答-------------------- DataTable dt = new DataTable("test");
dt.Columns.Add(new DataColumn("name", typeof(string)));
int[] s ={ 1, 2, 3, 4, 5 };
for (int i=0; i < s.Length; i++)
{
DataRow dr = dt.NewRow();
dr["name"] = "Paul" + s[i].ToString();
dt.Rows.Add(dr);
}
GridView1.DataSource = dt;
GridView1.DataBind();
楼主给分
补充:.NET技术 , ASP.NET