GridView OnRow更新 [英] GridView OnRow Updating
本文介绍了GridView OnRow更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,当我想从gridview OnRowUpdating中读取新值时使用此代码
string abc =((TextBox)Gridview1.Rows [e.RowIndex] .Cells [ 0 ]。控件[ 0 ])。文字;
它只显示旧值以获得新值..
请帮助我.....我想用新值更新它..
解决方案
按照我的回答 - 网格排序更新活动无法获得新值...... [ ^ ]。
很明显。因为你的GridView
每次都会在回发时绑定。如果要在Page_Load事件中绑定GridView,请检查回发。在 Not IsPostBack 块下绑定GridView。试试这个:
if (!IsPostBack)
{
// 在此处绑定您的gridview。
}
- Amit
您可以使用gridview的OnRowUpdated事件....
在这种情况下,你可以获取更新的新值
Hello, When I wnat to read the New value from the gridview OnRowUpdating with this code
string abc = ((TextBox)Gridview1.Rows[e.RowIndex].Cells[0].Controls[0]).Text;
It only showing the old value hot to get the new value..
please help me..... I want to update it with new values..解决方案Follow my answer - Gridview rowupdating event not able to get New values....[^].
It's obvious. Because yourGridView
is binding everytime on postbacks. If you are binding the GridView in Page_Load event, then check for postbacks. Bind your GridView under Not IsPostBack block. Try this:
if(!IsPostBack) { //Bind your gridview here. }
--Amit
You can use OnRowUpdated event of gridview....
In this event u can fetch updated new value
这篇关于GridView OnRow更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文