Asp:ImageButton Question

  • Thread starter Thread starter Shapper
  • Start date Start date
S

Shapper

Hello,

I have 2 Asp:ImageButton in my .aspx file and I have the function "Run"
in m .aspx.vb file. I need to run this function when one of the
ImageButtons is pressed but I need to know which one was pressed.

How can I do this?

I was trying with commandname and oncommand properties of
ASP:ImageButton but I was not able to make this work.

Can someone tell me how the code line would look in an ImageButton and
in my function:

Sub Run(???) ???
....

Thank You,
Miguel
 
Sub Run (sender as Object, argument as ImageClickEventArgs) Handles
Button1.Click, Button2.Click
dim button as ImageButton = ctype(sender, ImageButton)
if button.Id = "Button1" then

End Sub

or you could use the commandArgument at that point..

if ctype(sender, ImageButton).CommandArgument = "SomeArg" then


something like that should work.

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top