Postback eats button click event

Last post 12-23-2009 10:23 PM by ps2goat. 1 replies.

Sort Posts:

  • Sad [:(] Postback eats button click event

    12-23-2009, 7:23 PM
    • Member
      point Member
    • Anumitha
    • Member since 12-24-2009, 12:20 AM
    • Posts 1
    Hi,

    I have textboxes inside an updatepanel and a button outside the updatepanel.
    when the user changes the textbox text and then clicks the button(NOTE: donot click anywhere on the screen)
    the buttons click event doesn't fire only the textchanged event gets fired.
    My assumption is that both events would fire and the textchanged
    event would be first.

    Is there a work around to this bug?

    In normal cases when I type a text in textbox and tab,the button click event along with textchanged is fired.I want the same behaviour when i change the text and clickover button too.

     

  • Re: Postback eats button click event

    12-23-2009, 10:23 PM
    • Star
      10,719 point Star
    • ps2goat
    • Member since 11-17-2006, 5:43 PM
    • Posts 1,955

    You must understand that this is the nature of the web [not a bug].  Once the browser sends information to the server, everything stops.  The server process the information, and sends it down to the browser, where all subsequent events after the one that posted to the server are erased.

    You should use a javascript method for when the text changes, or don't have AutoPostBack on the textbox; that is what is firing the call to the server.  Do your check in the button click event instead.

    I haven't tested, but this option may also 'eat' your button click.  

    If you are only validating the entered data, you could also try using a validation control with clientside validation enabled.

    ---------------------------------------
    MCP - Web Based Client Development .NET 2.0
Page 1 of 1 (2 items)