Button Question. What am I doing wrong?

S

Shapper

Hello,

I want to take some action when a button image is pressed in my page.
This is what I have:

page.aspx:
<asp:imagebutton id="ibsend" runat="server"></asp:imagebutton>

page.aspx.vb:
Protected WithEvents ibsend As System.Web.UI.WebControls.Image
Private Sub Button_Click(sender As Object, e As EventArgs) Handles
ibsend
response.write("test")
End Sub

What am I doing wrong?

Thanks,
Miguel
 
D

David Lloyd

Miguel:

One observation is that you dimension ibsend as an Image rather than an
imagebutton. An image control does not have a click event.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hello,

I want to take some action when a button image is pressed in my page.
This is what I have:

page.aspx:
<asp:imagebutton id="ibsend" runat="server"></asp:imagebutton>

page.aspx.vb:
Protected WithEvents ibsend As System.Web.UI.WebControls.Image
Private Sub Button_Click(sender As Object, e As EventArgs) Handles
ibsend
response.write("test")
End Sub

What am I doing wrong?

Thanks,
Miguel
 
G

Guest

another point (along with actually dimming the ib correctly as a
"System.Web.UI.WebControls.ImageButton"

the "handles" clause in there is missing the vital ".click" off the end, so
it'll never actually fire

should be:

Private Sub Button_Click(sender As Object, e As EventArgs) Handles
ibsend.click

regards,

Paul Parkinson (www.elysaria.com)
 
A

Angrez Singh

Hi,

Another point while using imageclick event handlers use
ImageClickEventArgs as second parameter instead of EventArgs.

Regards,
Angrez
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top