473,387 Members | 1,572 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,387 software developers and data experts.

Webform button disabling problems

Hi,

I have a webform with some dropdown menus, textboxes required and custom
validators. I added a click event handler for the button in which there is
code for processing. This processing takes around one minute.

I want to disable the button after the user clicks on it so that he cannot
click it again while the processing is going on. But when I do this using
javascript, the button is getting disabled while the form is not getting
submitted.

I used btnSubmit.Attributes.Add("onclick", "disablebutton();") to add onlick
event to the button.

When the page is rendered the button html looks like this

<input type="submit" name="btnSubmit" value="Submit"
onclick="disablebutton();if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate(); " language="javascript" id="btnProceed" />

The javascript for disablebutton() is

function disableButton(){
document.Form1.btnSubmit.value = "Processing..........";
document.Form1.btnSubmit.disabled = true;
}

I don't know where I am going wrong. Can anyone please suggest me how to get
this work.

Thanks

Srinivas
Nov 18 '05 #1
2 1356
Hi

why not change the buttton to be an asp:button rather than a standard input. That way you can use code-behind to handle the event. The clicking of the button should also fire of any webforms validators. You can then just set the command buttons enabled property to false as the last step in the event

The declaration of the button would be simlar to the following

<asp:Button id="cmdNewSection" runat="server" Text="New"></asp:Button

James :-)
Nov 18 '05 #2
Thanks James.

I am already implementing the button as asp:button. The html I posted was
the html as seen using the browsers view source.

Srinivas
"James Culshaw" <Ja****@dumgal.gov.uk> wrote in message
news:D1**********************************@microsof t.com...
Hi,

why not change the buttton to be an asp:button rather than a standard input. That way you can use code-behind to handle the event. The clicking of
the button should also fire of any webforms validators. You can then just
set the command buttons enabled property to false as the last step in the
event.
The declaration of the button would be simlar to the following:

<asp:Button id="cmdNewSection" runat="server" Text="New"></asp:Button>

James :-)

Nov 18 '05 #3

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

Similar topics

1
by: teddy | last post by:
I am trying to create a bookstore WebApplication using c#. I can display the books (obtained from sql server) on a table in a WebForm. At the end of each row, I would like to add "add to cart"...
13
by: nick4soup | last post by:
General advice wanted: Some web sites (including two large companies in Australia) get themselves awfully confused if the user presses the BACK button in their browser (and possibly the forward...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
0
by: Flemming Jensen | last post by:
The idea behind this code is to standardize all my webpages in an application to look the same by inheriting the pages from a userdefined class. But it gives me problems regarding sessionstate... ...
2
by: mg | last post by:
What code (javascript) will cause a WebForm to be submited (runatserver) whenever a new character is typed into a TextBox from the keyboard?
4
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). ...
4
by: Arvind P Rangan | last post by:
Hi, Has anybody worked on disabling postback event of button event in webforms. As it does not have a property of autopostback how do we make it disable. I tried few article but they have...
5
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have start web form and when the user clicks a button (server.transfer) they are directed to the second webform. I was wondering if there is a way to create an instance of the first webform...
2
by: chrisp | last post by:
I have an ASP.NET 2 page with a button that causes a credit card transaction to be authorised. The authorisation procedure may take a few seconds and so I want to prevent the user from clicking the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.