日期:2014-05-17  浏览次数:20819 次

GridView编辑更新取不到新值
 protected void gvWellsManager_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string wNo = ((TextBox)gvWellsManager.Rows[e.RowIndex].Cells[1].Controls[0]).Text.Trim();
            string wName = ((TextBox)(gvWellsManager.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim();
            string sBoiler = ((TextBox)(gvWellsManager.Rows[e.RowIndex].Cells[3].Controls[0])).Text.Trim();
            string sManagerArea = ((TextBox)(gvWellsManager.Rows[e.RowIndex].Cells[4].Controls[0])).Text.Trim();
            string sIsSteam = ((TextBox)(gvWellsManager.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();

            Wells well = new Wells();
            if (well.WellUpdate(wNo, wName, sBoiler, sManagerArea, sIsSteam))
            {
                WellsInfoBind();
            }
        }


这个代码为什么只能取到GridView原有的值,而新修改的值取不到呢?

------解决方案--------------------
GridView新赋值的语句在哪里
------解决方案--------------------
  //GridView改为只读状态
        this.GridView1.EditIndex = -1;