Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Web form event handler not firing?

Reply
Thread Tools

Web form event handler not firing?

 
 
jeff29_b@yahoo.com
Guest
Posts: n/a
 
      02-14-2005
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.

 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      02-14-2005
Jeff:
You didn't provide us with much detail (like sample code), but there is a
known bug in FireFox 1.0 where, if you leave the ImageUrl blank, postback
won't fire.
https://bugzilla.mozilla.org/show_bug.cgi?id=258621

So this is assuming you aren't specifying an image...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


<> wrote in message
news: oups.com...
> 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.
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3RlcGhlbiBKLiBLbGFkaWNo?=
Guest
Posts: n/a
 
      04-06-2005
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

"Karl Seguin" wrote:

> Jeff:
> You didn't provide us with much detail (like sample code), but there is a
> known bug in FireFox 1.0 where, if you leave the ImageUrl blank, postback
> won't fire.
> https://bugzilla.mozilla.org/show_bug.cgi?id=258621
>
> So this is assuming you aren't specifying an image...
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> <> wrote in message
> news: oups.com...
> > 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.
> >

>
>
>

 
Reply With Quote
 
Bruce Barker
Guest
Posts: n/a
 
      04-06-2005

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)



"Stephen J. Kladich" <> wrote in
message news:106CCFEA-7591-4327-B277-...
> 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
>
> "Karl Seguin" wrote:
>
>> Jeff:
>> You didn't provide us with much detail (like sample code), but there is a
>> known bug in FireFox 1.0 where, if you leave the ImageUrl blank, postback
>> won't fire.
>> https://bugzilla.mozilla.org/show_bug.cgi?id=258621
>>
>> So this is assuming you aren't specifying an image...
>>
>> Karl
>>
>> --
>> MY ASP.Net tutorials
>> http://www.openmymind.net/
>>
>>
>> <> wrote in message
>> news: oups.com...
>> > 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.
>> >

>>
>>
>>



 
Reply With Quote
 
ajaimisra ajaimisra is offline
Junior Member
Join Date: Aug 2006
Posts: 1
 
      08-04-2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Handler that creates adds another event handler kaczmar2@gmail.com ASP .Net 1 02-22-2007 07:37 AM
rendering Button inside Render() event, makes it loose its click event handler association sonic ASP .Net 1 01-07-2005 06:33 PM
How to recall add event from an Event handler?? RC ASP .Net Web Controls 1 01-06-2005 07:44 PM
How to ref web form controls in client side event handler? Eric ASP .Net 3 11-09-2004 01:22 PM
Problem calling event handler in web form (C#) Andrew Banks ASP .Net 2 03-03-2004 01:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57