Ask a Question related to ASP.NET General, Design and Development.
-
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 Guest
-
disabling enter button (revisited)
I posted this question before, but all the answers given were not feasible either because it's a VERY long form (so I don't want to make everything... -
disabling button control on grid.
How would I disable a push button control I have in column 2 based on information based on column 1, say a bool field. I figured it would be coded... -
Disabling Datagrid Link Button
Hi all, I have a datagrid with 3 columns with the last one being a link button which does a postback. The page hides/shows a panel control with... -
post to server using controls or code other than a button
Don't forget that the client-side script has a Submit() method that can submit a form without a button. In the following code, I use a literal... -
Disabling Command button if Table can't be locked
I am reposting this because my last attempt in a prior message was not very clear. I have created a command button (Reset Main) that is linked... -
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(xxx_Update) the update event still doesn't
get called.
Paul.
Paul Guest
-
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 [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
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.setTimeout('PartyEdit_Update.disabled=true ', 100)"
--
H. Ivanov [MS]
Please reply to newsgroup.
"Paul" <qwe@qwe.com> wrote in message
news:02df01c33f33$6e8ef350$a101280a@phx.gbl...> 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.Attributes["onclick"] = this.Update.ClientID
> + ".disabled=true;";
>
> And this results in this on the client:
> <input type="submit" name="PartyEdit:Update"
> value="Update" onclick="PartyEdit_Update.disabled=true;if
> (typeof(Page_ClientValidate) == 'function')
> Page_ClientValidate(); " language="javascript"
> id="PartyEdit_Update" class="UpdateControl" />
>
> I think the validation code checks to see if the button
> is enabled and as I've disabled it it fails to run.
>
> Paul.
Hristo Ivanov [MS] Guest



Reply With Quote

