当前位置:编程学习 > C#/ASP.NET >>

修改datagrid中数据??

用了DataGrid_EditCommand修改某行, 然后update,但我修改后的数据,再debug中打印出来怎么还是没修改前的数据啊??

private void DGProduct_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
TextBox Tproduct = e.Item.Cells[1].FindControl("productid") as TextBox;
TextBox Tdetailtype = e.Item.Cells[2].FindControl("detailtype") as TextBox;
TextBox Tsingleprice = e.Item.Cells[3].FindControl("singleprice") as TextBox;

string idstr = Tproduct.Text;
string dystr = Tdetailtype.Text;
string spstr = Tsingleprice.Text;

int productid = Convert.ToInt32(idstr);
  
Debug.WriteLine(productid.ToString());
Debug.WriteLine(dystr);
Debug.WriteLine(spstr);
} --------------------编程问答-------------------- 要重新绑定数据才可以呀. --------------------编程问答-------------------- 但是现在 我修改后的数据取不到啊,还是没修改前的数据。。 --------------------编程问答-------------------- 你先看看数据库里有没有更改过来,如果数据库有改的话,那你在修改后重新绑定列表就可以了。 --------------------编程问答-------------------- 初始绑定没有放在!IsPostBack里 --------------------编程问答--------------------
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,