本文介绍了griedview文本框中的更新在编辑模式下传递旧值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的gridview更新事件的代码。在编辑模式下我更改文本框中的值仍然会传递旧值..





 protected void SubCategoryGrid_RowUpdating(object sender,GridViewUpdateEventArgs e)
{
string scn;
int catid;
int scatid = Convert.ToInt32(((Label)(SubCategoryGrid.Rows [e.RowIndex] .FindControl(scidlbl)))。Text);
TextBox box1 =(TextBox)SubCategoryGrid.Rows [e.RowIndex] .FindControl(txteditscatname);
TextBox txt2 =(TextBox)SubCategoryGrid.Rows [e.RowIndex] .FindControl(txteditcatid);

scn = box1.Text;
catid = Convert.ToInt32(txt2.Text);
d.editsubcategory(scn,scatid,catid);
SubCategoryGrid.EditIndex = -1;
FILLSUBCATGRID();
}
解决方案

this is my code for gridview update event.after i change value in text box in edit mode still it passes old value..


protected void SubCategoryGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
       {
           string scn;
           int catid;
           int scatid = Convert.ToInt32(((Label)(SubCategoryGrid.Rows[e.RowIndex].FindControl("scidlbl"))).Text);
           TextBox box1 = (TextBox)SubCategoryGrid.Rows[e.RowIndex].FindControl("txteditscatname");
           TextBox txt2 = (TextBox)SubCategoryGrid.Rows[e.RowIndex].FindControl("txteditcatid");

           scn = box1.Text;
           catid = Convert.ToInt32(txt2.Text);
           d.editsubcategory(scn, scatid,catid);
           SubCategoryGrid.EditIndex = -1;
           FILLSUBCATGRID();
       }
解决方案


这篇关于griedview文本框中的更新在编辑模式下传递旧值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 10:04