我在GRIDVIEW 里面点更新时为什么取的不是我手动输入文本框的值是最初加载GridView的值??代码如下:
难道我写错了?
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string strID = GridView1.Rows[e.RowIndex].Cells[0].Text;
int sID=Convert.ToInt32(strID);
string strName = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
string strPos = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
string strEmail = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
string strMob = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
string strPho = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text;
string strQQ = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text;
string strMsn = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[7].Controls[0]).Text;
难道我写错了?
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string strID = GridView1.Rows[e.RowIndex].Cells[0].Text;
int sID=Convert.ToInt32(strID);
string strName = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
string strPos = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
string strEmail = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[3].Controls[0]).Text;
string strMob = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[4].Controls[0]).Text;
string strPho = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[5].Controls[0]).Text;
string strQQ = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[6].Controls[0]).Text;
string strMsn = ((TextBox)this.GridView1.Rows[e.RowIndex].Cells[7].Controls[0]).Text;
解决方案 »
- asp.net2008 FileUpload 问题
- 如何gridview导出到excel中并默认打开?
- ASP.NET程序打包成EXE程序
- 微信公众平台开放消息接口设置的问题
- 关于网站服务器的最低配置的问题。
- 会div+css的人进来看一下。解决了100分。兼容问题.咋ie7.FF下边都正常。就ie6不行
- DataGrid綁定值的讀取.
- ASP.NET精品全站程序SQL版一例,那位达人研究过,给小弟讲解一下?
- 我是数据库操作菜鸟,大家帮帮我!
- 升星星要多少分啊(五角的)
- 明天放假啦~心情好放个小代码~ ^_^ "用DIV+CSS实现文字及面板阴影效果"
- datagrid,高手请进呀.急了一天了.谢谢
这是更新的方法 emp.UpdateQuery(strName, nDepID, strPos, strEmail, strMob, strPho, strQQ, strMsn, strState, CmpID, sID);
GridView1.EditIndex = -1;
GridView1.DataBind();
{
//然后绑定
}
{
数据绑定
}
同我一样,回答两个不同的问题,答案都一样.