![]() |
#2
multiple19O22008-06-08 19:43
|
调用NotrhWind数据库,并将数据绑定至GridView1中,并添加了修改功能,其他功能都没问题,现在遇到的问题是点击更新之后无法获取GridView1中修改后的数据(得到的都是旧的数据),哪位朋友知道的帮忙解决一下
下边是我写的获取新内容的代码:

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string strCus = this.GridView1.DataKeys[e.RowIndex][0].ToString();
string strCompanyName = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).Text.ToString();
string strContractName = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.ToString();
string strAddress = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text.ToString();
updateCustomers(strCus, strCompanyName, strContractName, strAddress);
}
{
string strCus = this.GridView1.DataKeys[e.RowIndex][0].ToString();
string strCompanyName = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).Text.ToString();
string strContractName = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text.ToString();
string strAddress = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text.ToString();
updateCustomers(strCus, strCompanyName, strContractName, strAddress);
}
[[it] 本帖最后由 天堂落日 于 2008-6-8 12:11 编辑 [/it]]
[[it] 本帖最后由 天堂落日 于 2008-6-18 10:18 编辑 [/it]]