为什么行[e.RowIndex]在gridview中的rowupdating事件中是不可用的 [英] Why Rows[ e.RowIndex] Is Unavalable in rowupdating event in gridview
本文介绍了为什么行[e.RowIndex]在gridview中的rowupdating事件中是不可用的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里是问题的快照。
http:// picturepush .com / public / 12511015 [ ^ ]
here''s a snapshot of problem.
http://picturepush.com/public/12511015[^]
protected void _GRD1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
string s = ((TextBox)_GRD1.Rows[e.RowIndex].FindControl("TextBox1")).Text;
}
错误消息msg是RowIndex不存在。
error msg is RowIndex doesnot exist.
推荐答案
不要混淆不同事件中使用的两种不同的事件参数类型:System.Web.UI.WebControls.GridViewUpdateEventArgs
和System.Web.UI.WebControls.GridViewUpdatedEventArgs
:第一个确实有RowIndex
,第二个没有:
http://msdn.microsoft.com/en-us/ library / system.web.ui.webcontrols.gridviewupdateeventargs.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewupdatedeventargs.aspx [<一个href =http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewupdatedeventargs.aspxtarget =_ blanktitle =New Window> ^ ]。
-SA
Don''t mix up two different event arguments types used in different events:System.Web.UI.WebControls.GridViewUpdateEventArgs
andSystem.Web.UI.WebControls.GridViewUpdatedEventArgs
: first one does haveRowIndex
, and the second one does not:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewupdateeventargs.aspx[^],
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewupdatedeventargs.aspx[^].
—SA
这篇关于为什么行[e.RowIndex]在gridview中的rowupdating事件中是不可用的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文