当前位置: 代码迷 >> ASP.NET >> GridView的有关问题?
  详细解决方案

GridView的有关问题?

热度:8119   发布时间:2013-02-26 00:00:00.0
GridView的问题????????????
我在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;

------解决方案--------------------------------------------------------
yes,在Page_Load事件中添加

if(!Page.IsPostBack)
{
数据绑定
}
------解决方案--------------------------------------------------------
把gridiview绑定放在if(!ispostback){}里面
------解决方案--------------------------------------------------------
babyrockxray(紫色阴影) ( )同我一样,回答两个不同的问题,答案都一样.
  相关解决方案