Gridvew行绑定事件中出现错误 [英] Getting Error in Gridvew Row bound event
本文介绍了Gridvew行绑定事件中出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
protected void gdvDataQualityReport_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton link = e.Row.FindControl("LinkButton1") as LinkButton;
link.Attributes["onclick"] = "return popwin(" + ((DataAvailabilityEntity)e.Row.DataItem).SourceTableName + ")";
}
}
这是我在单击gridview的链接按钮时打开一个弹出窗口编写的代码.但给出的错误是GridViewCommandEventArgs e不包含Row的定义.
任何人都可以帮助我解决这个问题.
非常感谢,
Amal
this is the code which i wrote to open a pop up window while clicking on my gridview''s link button.but its giving eror saying GridViewCommandEventArgs e does not contain a definition for Row.
can anyone pls help me in resolving this.
Many Thanks,
Amal
推荐答案
是的,GridViewCommandEventArgs
e不包含Row
的定义.尝试在GridView
的RowDataBound
Event中执行相同的操作.
--Amit
Yes,GridViewCommandEventArgs
e does not contain a definition forRow
. Try doing the same inRowDataBound
Event ofGridView
.
--Amit
如果要在所有行中搜索控件,则应使用GridView的OnRowDataBound
事件,此方法将GridViewRowEventArgs
作为对象的参数.
If you are searching your control in all Rows then you should useOnRowDataBound
event of GridView this method takesGridViewRowEventArgs
as a parameter with Object.
protected void gridview_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//do your stuff.
}
}
希望对您有帮助.
祝你好运.
--Rajesh
Hope it will help you.
Good luck.
--Rajesh
这篇关于Gridvew行绑定事件中出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文