CommandArgument属性 绑定参数

CommandArgument 获取或设置与关联的 CommandName 属性一起传递到 Command 事件处理程序的可选参数。

参考代码:
在数据控件中加入imagebutton,如果想要获取某个值,使用它的CommandArgument属性就不需要使用findcontrol等方法查找了

 

                         οnclick="ImageButton1_Click" CausesValidation="False" CommandArgument='<%#Eval("Ra_ID")%>'/>

 

 

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton myL = (ImageButton)sender;
        string recaddid = myL.CommandArgument;

     }

你可能感兴趣的:(CommandArgument属性 绑定参数)