get CommandArgument from ImageButton onClick, VB

半世苍凉 提交于 2019-12-25 02:08:22

问题


I have a series of ImageButtons...when I click on the image, I want to redirect to another page, using the CommandArgument as a uniqueId...How can i get the commandArgument from the onclick event? Thanks!


回答1:


Don't use the OnClick event. Use the OnCommand event

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


来源:https://stackoverflow.com/questions/7957816/get-commandargument-from-imagebutton-onclick-vb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!