473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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.

Nov 17 '05 #1
3 2078
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.
Nov 17 '05 #2
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!
Nov 17 '05 #3
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" <qw*@qwe.com> wrote in message
news:02****************************@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.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: jcnews | last post by:
When designing a webpage, is there a way to disable the back button? It must be possible. I am asking because there are certain web applications that I have used that require the user to...
3
by: Mark | last post by:
This is a solution... Often users want to keep clicking "submit" when they are waiting for server processing. Most apps these days like to disable the submit button to prevent this. You can't just...
4
by: Dan =o\) | last post by:
Hi guys, in the scenario where a user fills in a form, and clicks on a button to Save, there's a period of waiting (the slower the connection between client and server, the longer the delay)...
6
by: MW de Jager | last post by:
I'm trying to create an html page that will change dynamically. I need to switch html -buttons between visible and invisible. Is there any way I can do this with a script? Regards MW
2
by: pradeep_TP | last post by:
Hello world, I have a simple datagrid on asp.net web form , in which I am showing a single button column called EDIT. The code in the .aspx files for the same is as below. ...
2
by: Michael Groeger | last post by:
Hi all, I want to disable a button after it's clicked on the clients side, so that this cannot be clicked twice. I tried this with adding the "onclick" attribute to the button and disable the...
9
by: Paul Keegstra | last post by:
Hi, I am currently working on an asp.net 2.0 web site that is a replacement of a classic asp web site. The current web site uses a Commerce Server 2002 database for storing user information. ...
3
by: ChrisN | last post by:
Invoking a postback before a large ASP.NET page has fully rendered will often cause the page to crash. This is unhelpful and confusing to users. I'm wondering if I can overcome this by...
8
by: Willie | last post by:
Hi All; I have a form with multiple buttons and I would like to disable the buttons after the user clicks on the button to prevent multiple submitions. <input type="submit" name="return1"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.