asp.net - Passing a value back from ImageButton -
i'm learning doing wrong. want display multiple avatar images on screen (75 when suss bit) , have user select one. when click 1 calls procedure avatar_click need recognise 1 has been clicked.. how do ? have far..
<td><asp:imagebutton id="imagebutton1" runat="server" width="20px" imageurl="~/files/images/avatars/a01 copy.gif" onclick="avatar_click" /></td> <td><asp:imagebutton id="imagebutton2" runat="server" width="20px" imageurl="~/files/images/avatars/a02 copy.gif" onclick="avatar_click" /></td> <td><asp:imagebutton id="imagebutton3" runat="server" width="20px" imageurl="~/files/images/avatars/a03 copy.gif" onclick="avatar_click" /></td> protected sub avatar_click(sender object, e eventargs) end sub
what need put in vb procedure avatar_click ?
any appreciated.
add commandargument each button
<td><asp:imagebutton id="imagebutton1" runat="server" width="20px" imageurl="~/files/images/avatars/a01 copy.gif" commandargument="a01" onclick="avatar_click" /></td> <td><asp:imagebutton id="imagebutton2" runat="server" width="20px" imageurl="~/files/images/avatars/a02 copy.gif" commandargument="a02" onclick="avatar_click" /></td> <td><asp:imagebutton id="imagebutton3" runat="server" width="20px" imageurl="~/files/images/avatars/a03 copy.gif" commandargument="a03" onclick="avatar_click" /></td>
in button click, retrieve commandargument
protected sub avatar_click(sender object, e eventargs) dim btn imagebutton = ctype(sender, imagebutton) dim buttonclickedvalue string = btn.commandargument end sub
Comments
Post a Comment