Web form event handler not firing?

J

jeff29_b

I am having a strange problem on a web form. I have an image button
with an OnClick event handler. When I click the image the event isn't
being called in the code behind when browsing in firefox. I get the
postback but I never have the event called. It works fine in i.e.
 
G

Guest

Hi all,

Karl: thanks for the info on the bug, you were dead on. Interesting to note
that the posters on that site blame ASP.Net for this.
In your post you note that if the URL for the image is not good, the
arguments do not pass. Note that if you hide the button (style:display:none),
you also get the negative result in Mozilla/Firefox/Netscpape, even if the
image URL/Src is good.

I had a similar situation which I will post for the sake of others searching:

I had an Html Server Control <input type="image" runat="server" ... on which
I put an onclick event handler as well as the onserverlick. I had another
image button on my page as well. In Mozilla/Netscape the button without the
client onclick submitted fine and it's server-side code would run, but not
the button with the client-side event handler. Note: All worked fine in IE!

The client side code "swapped" them image to another one (hiding the image
using style=dispay:none on the button before form submittal to prevent
multiple form submissions/double clicks) hence the lack of arguments to the
server side event handler.

I ended up not hding the button but placing another over top to catch the
clicks...and so it worked fine after that in all browsers.
Well I had a problem there too in that the Divs I was using wouldn't change
thier z-index in IE 6, but worked fine in Mozilla/Firefox/Netscape (I had the
position set to relative!) Oh well, after more searching I got my solution to
that.

Thanks,
Stephen
 
B

Bruce Barker

its not a firefox bug, its an asp.net bug.

if there is no image and thus no image click (or return is used), it makes
no sense to send the x and y coordinates (as there aren't any). the image
value is posted. asp.net has a bug, where it only looks for the x and y
values, not the image value.

-- bruce (sqlwork.com)
 
Joined
Aug 4, 2006
Messages
1
Reaction score
0
hi Bruce Barker ,
Plz do one help me too.
I am creating a web form and attaching a button in that form and i want to print a text like "HELLO" .and on click of button its not being.all the things is being normal. code is given below.give ur a look on that.Tell me something?

namespace WebApplication1
{
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}

private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("hello");
}
}
}

thanks in advance
 

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

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top