stop button postback ajax in non-ie

Discussion in 'ASP .Net' started by gerry, Nov 21, 2007.

  1. gerry

    gerry Guest

    Sung the ASP.NET AJAX framework, and following the control creation examples
    from the ajax toolkit I have created a simple custom control that includes a
    button with a client side onClick handler.
    Returning false from the handler prevents postbacks in IE but in firefox the
    handler fires and does its thing but the postback still occurs as well.
    I read that changing this from an INPUT SUMIT to a BUTTON would fix this
    problem, however that to me is a problem as it always prevents postbacks. I
    would still want postbacks to occur in the case where scripting is turned
    off or not supported.

    If I add an asp:Button to the page and set the
    OnClientClick="alert('hi');return false;" the postback is suppressed in all
    browsers as it should be - so I assume that the problem is buried somewhere
    in the ajax framework.

    Any suggestions ?

    Gerry
     
    gerry, Nov 21, 2007
    #1
    1. Advertising

  2. Hi Gerry,

    I'm not very sure about your question, is it related to AJAX Control
    Toolkit or you're just creating a simple ScriptControl?

    Could you please post the complete code that could help to reproduce the
    issue? Also, what's the version of Firefox you're using?

    Thanks for the effort.


    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Walter Wang [MSFT], Nov 22, 2007
    #2
    1. Advertising

  3. gerry

    gerry Guest

    Hi Walter,

    I am creating a "Custom ASP.NET AJAX Client Controls" based on examples in
    the Ajax Control Toolkit.

    I foundthe solution : rather than returning false from the event handler , I
    called event.preventDefault();
    _onButtonClick : function( e ) {
    alert("Click Handler.");
    e.preventDefault();
    }


    Gerry



    ""Walter Wang [MSFT]"" <> wrote in message
    news:...
    > Hi Gerry,
    >
    > I'm not very sure about your question, is it related to AJAX Control
    > Toolkit or you're just creating a simple ScriptControl?
    >
    > Could you please post the complete code that could help to reproduce the
    > issue? Also, what's the version of Firefox you're using?
    >
    > Thanks for the effort.
    >
    >
    > Regards,
    > Walter Wang (, remove 'online.')
    > Microsoft Online Community Support
    >
    > ==================================================
    > When responding to posts, please "Reply to Group" via your newsreader so
    > that others may learn and benefit from your issue.
    > ==================================================
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    >
     
    gerry, Nov 22, 2007
    #3
  4. Hi Gerry,

    Thanks for sharing your solution here. Please feel free to let me know if
    there's anything else I can help.


    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Walter Wang [MSFT], Nov 23, 2007
    #4
    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. minnie
    Replies:
    1
    Views:
    720
    Andrew Thompson
    Dec 13, 2006
  2. Matthew Wells

    Stop postback/refresh using a button...

    Matthew Wells, Mar 1, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    3,318
    Ralph
    Sep 16, 2009
  3. ton
    Replies:
    2
    Views:
    2,169
  4. Wael_Bakr

    stop postback in postback events for server controls ??

    Wael_Bakr, Nov 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    508
    Wael_Bakr
    Nov 30, 2005
  5. Stop Postback in image button

    , Jul 26, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    257
    Alessandro Zifiglio
    Jul 26, 2006
Loading...

Share This Page