Web form event handler not firing?

Discussion in 'ASP .Net' started by jeff29_b@yahoo.com, Feb 14, 2005.

  1. Guest

    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.
     
    , Feb 14, 2005
    #1
    1. Advertising

  2. Karl Seguin Guest

    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:...
    > 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.
    >
     
    Karl Seguin, Feb 14, 2005
    #2
    1. Advertising

  3. 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:...
    > > 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.
    > >

    >
    >
    >
     
    =?Utf-8?B?U3RlcGhlbiBKLiBLbGFkaWNo?=, Apr 6, 2005
    #3
  4. Bruce Barker Guest

    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:...
    > 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:...
    >> > 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.
    >> >

    >>
    >>
    >>
     
    Bruce Barker, Apr 6, 2005
    #4
  5. ajaimisra

    Joined:
    Aug 4, 2006
    Messages:
    1
    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
     
    ajaimisra, Aug 4, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jespey
    Replies:
    0
    Views:
    557
    jespey
    Nov 12, 2003
  2. Wee Bubba
    Replies:
    0
    Views:
    555
    Wee Bubba
    May 24, 2004
  3. Tom Perkin

    Event handler not firing

    Tom Perkin, Dec 2, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    415
    Tom Perkin
    Dec 2, 2005
  4. TS
    Replies:
    4
    Views:
    11,785
    Steven Cheng[MSFT]
    Aug 22, 2006
  5. Replies:
    1
    Views:
    756
    Damien
    Feb 22, 2007
Loading...

Share This Page