Disabling a button but calling its server code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul

    #1

    Disabling a button but calling its server code

    Hi

    I am trying to create an "Update" button for my form.

    So far I have got it working fine, posting back and
    updating the record. Great!

    However, I now want to make it so that when a user
    presses "Update", the caption changes to "Updating.. ."
    and the button disables (to prevent multiple form
    submissions).

    I can change the caption of the button easily enough, but
    if I try disabling the button the server code fails to
    run. I suppose this kind of makes sense - why would you
    want to run code for a disabled button - however, to
    achieve what I want I DO NEED to run the code. I have
    tried calling __doPostBack from the buttons onclick event
    but this doesn't work.

    Any ideas?

    Thanks, Paul.

  • Paul

    #2
    Re: Disabling a button but calling its server code

    I've tried this but to no avail.

    If I disable the button in jscript and then call
    __doPostBack(xx x_Update) the update event still doesn't
    get called.

    Paul.

    Comment

    • Natty Gur

      #3
      Re: Disabling a button but calling its server code

      But you dont need to call the __dopostback for button. the button sends
      the Form without __dopostback.

      Natty Gur, CTO
      Dao2Com Ltd.
      28th Baruch Hirsch st. Bnei-Brak
      Israel , 51114

      Phone Numbers:
      Office: +972-(0)3-5786668
      Fax: +972-(0)3-5703475
      Mobile: +972-(0)58-888377

      Know the overall picture


      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Hristo Ivanov [MS]

        #4
        Re: Disabling a button but calling its server code

        Try to disable the button with some delay. Instead of "disabled=true" , try
        "window.setTime out('PartyEdit_ Update.disabled =true', 100)"

        --
        H. Ivanov [MS]
        Please reply to newsgroup.


        "Paul" <qwe@qwe.com> wrote in message
        news:02df01c33f 33$6e8ef350$a10 1280a@phx.gbl.. .[color=blue]
        > Hi Natty
        >
        > I have tried this and the button disables but the form
        > doesn't post back.
        >
        > Heres the server code I use:
        > this.Update.Att ributes["onclick"] = this.Update.Cli entID
        > + ".disabled=true ;";
        >
        > And this results in this on the client:
        > <input type="submit" name="PartyEdit :Update"
        > value="Update" onclick="PartyE dit_Update.disa bled=true;if
        > (typeof(Page_Cl ientValidate) == 'function')
        > Page_ClientVali date(); " language="javas cript"
        > id="PartyEdit_U pdate" class="UpdateCo ntrol" />
        >
        > I think the validation code checks to see if the button
        > is enabled and as I've disabled it it fails to run.
        >
        > Paul.[/color]


        Comment

        Working...