我使用datatable(View State)作为数据源来绑定Gridview但是如何将datatable更新为datasource。 [英] i am using datatable(View State) as datasource to bind Gridview but how to update datatable to datasource.
本文介绍了我使用datatable(View State)作为数据源来绑定Gridview但是如何将datatable更新为datasource。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用datatable(View State)作为数据源来绑定Gridview,但是如何将datatable更新为datasource。
i am using datatable(View State) as datasource to bind Gridview but how to update datatable to datasource.
protected void GridView3_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = (GridViewRow)GridView3.Rows[e.RowIndex];
DataTable tableupd = ViewState["CurrentTable"] as DataTable;
//How to Update datatable here.....
GridView3.DataSource = tableupd;
GridView3.DataBind();
}
推荐答案
foreach(DataRow dr in table.Rows) // search whole table
{
if(dr["Product_id"] == 2) // if id==2
{
dr["Product_name"] = "cde"; //change the name
//break; break or not depending on you
}
}
这篇关于我使用datatable(View State)作为数据源来绑定Gridview但是如何将datatable更新为datasource。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文