从ImageButton获取CommandArgument onClick,VB

Joh*_*nna 0 asp.net onclick commandargument

我有一系列的ImageButtons ...当我点击图像时,我想重定向到另一个页面,使用CommandArgument作为uniqueId ...如何从onclick事件中获取commandArgument?谢谢!

drd*_*cox 5

不要使用OnClick事件.使用OnCommand事件

Protected Sub ImageButton1_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
    Dim arg As String = e.CommandArgument.ToString()

    ' use arg
End Sub
Run Code Online (Sandbox Code Playgroud)