473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Asp:ImageButton Question

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

Nov 19 '05 #1
1 1255

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

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:eo**************@TK2MSFTNGP14.phx.gbl...
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: nicole | last post by:
We have completed a clean install of Microsoft Server 2003 on our Web Server and are using frontpage 2002 for our web site. On our asp page (www.dgf.k12.mn.us/contactus.asp) we are getting the...
1
by: Darren Clark | last post by:
I need to be able to send through 2 peices of infomraiton in the commandArgument property of a image button... <asp:imagebutton CommandArgument='<%# DataBinder.Eval(Container,"DataItem."+...
1
by: JIM | last post by:
Hello, Does anyone knows how to set the visible property of an asp:Imagebutton to true with javascript I've the following declared : <asp:ImageButton Id="tstImage" runat="server"...
1
by: Michael Evanchik | last post by:
The following tag works fine in internet explorer, but in mozilla the image is not sized and left at its actualy size. Anyone know why? I though asp.net works on any browswer. ...
3
by: JIM | last post by:
Hello, I've an asp:Imagebutton on my form with the visible property set to false <asp:Imagebutton ID="tstImage" runat=Server visible=False> How can I set the visible propery to true using a...
3
by: thechaosengine | last post by:
Hi all, I need to be able to cause the following chain of events after clicking an asp:button but I don't know how to do it. I'd really appreciate any advice on this or alternative approaches: ...
5
by: Alex D. | last post by:
Does any body knows how to link an asp:textbox to an asp:imagebutton, both inside a User Control in asp.net 2 beta 2? So when a user enter some text in the textbox and press the "Enter" key the...
13
by: tperri | last post by:
I have an HTML table with several fields like this: <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood" ImageUrl="images\buttons\btn-food-i.gif"...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.