读书人

gridview在更新的时候无法得到值解决办

发布时间: 2012-02-13 17:20:26 作者: rapoo

gridview在更新的时候无法得到值
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string titname = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBoxName")).Text;

Response.Write(titname);

}

我用的是模板绑定的数据,编辑模板中有TextBox,他的id是TextBoxName,在编辑状态下我往textbox中输入一个值,单击更新后还是原来的值,我输入的新值不显示,是什么原因呀,请大家指点,谢谢了!!

[解决办法]
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
在这里面绑定GridView
}
}

读书人网 >asp.net

热点推荐