CommandArgument 获取或设置与关联的 CommandName 属性一起传递到 Command 事件处理程序的可选参数。
参考代码:
在数据控件中加入imagebutton,如果想要获取某个值,使用它的CommandArgument属性就不需要使用findcontrol等方法查找了
<asp:ImageButton ID="ImageButton" runat="server" ImageUrl="imag/nxt.gif"
onclick="ImageButton1_Click" CausesValidation="False" CommandArgument='<%#Eval("Ra_ID")%>'/>
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
ImageButton myL = (ImageButton)sender;
string recaddid = myL.CommandArgument;
}
本文介绍了ASP.NET中CommandArgument属性的使用方法,通过示例代码展示了如何在ImageButton控件上设置该属性,并在点击事件中获取对应的值,简化了数据控件中参数的传递过程。
197

被折叠的 条评论
为什么被折叠?



