Firing events?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a webform with an Image Button on it and an attached event handler
for a Click event.

I have the same on another page.

This click event for the first one doesn't work - you click on it and it
doesn't even attempt to postback.

The second one does.

The code between the two pages seems the same however when I view source on
the second one I get all of the web/ui/ javascript functionality but not on
the first.

Is there a switch or something I could be missing?

Many thanks

Jof
 
Check the HTML code and ensure both buttons are nested in the <form> tag. If
not, you will not get a postback for the button outside.

Second, make sure you have the handler set up. For some strange reason, esp
with Visual Studio .NET, the handlers are lost. I have only had this happen,
thus far, in Visual Basic .NET. The handler will be something like:

Protected Sub Button1_Click(sender As Object, e As EventArgs)

It needs to be like:

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click

For C#, the handler is like:

Button1.Click += new EventHandler(this.Button1_Click);

Once you link the handler set up, everything works fine.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
Just try removing the image button for which the event
does not work, and add it again. Don't waste time in these
matters buddy!

Sunil TG
 
Tried that already...but....

the solution is overlapping forms.

on my page I had a server control with its own form and they were
overlapping.

Solution solved! Thanks for the help though!
 
Hi,

could we take a look at your codes for the first button, both the UI and the
implementation part of it

--
Thank you very much

Warmest Regards,
Softwaremaker (WilliamT)
Software Architect
+++++++++++++++++++
 
Back
Top