473,804 Members | 3,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disable an ASP.NET form on the client before PostBack

I'm wondering if there's a way to use javascript to disable a ASP.NET web
page before it starts to postback. Specifically, here's what I'm running
into. I've got a webform that has an autopostback dropdown box, and a couple
of textboxes just below it. When the user selects an option from the
dropdown, it triggers a postback event, which in-turn slightly adjusts the
remainder of the page.

The problem is that if the user is on a slow dial-up connection, they have
time to tab down below and start filling in the textboxes before the
postback mechanism kicks in and submits the form to the server. From the
user perspective, they've selected a value from the dropdown and now they
are typing along in the textbox, and all of the sudden the page posts back.

What I would like to do is add "document.body. disabled = true;" that will
execute immediately when the postback mechanism is started. I can get this
idea working great when the postback is caused by something like a button
and I use the RegisterOnSubmi tStatement method of the page class, but the
AutoPostBack feature of the dropdown list bypasses the client-side onsubmit
event (this is a know/intended "issue").

What I'm wondering if there is a way to influence the output of the
__doPostBack script that my page is rendering out? Ideally, I could just add
my disable script right there in the beginning of that script and everything
would work great.

If anybody has any ideas on this, please let me know.

Thanks,
Chris
Nov 17 '05 #1
1 2369
a cleaner way is to just hide the button on the click event using attributes
or client side script. Anyone will do. That way as soon as you click, the
text boxes are gone so users cannot use the textboxes since they aren't
there. Or you can disable them as well.

DropdownList1.A ttributes.Add(" onclick","docum ent.all.textbox 1.style.display =
''");

roughly

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Christophe r D. Wiederspan" <wi********@net quote.com> wrote in message
news:OL******** ******@TK2MSFTN GP11.phx.gbl...
I'm wondering if there's a way to use javascript to disable a ASP.NET web
page before it starts to postback. Specifically, here's what I'm running
into. I've got a webform that has an autopostback dropdown box, and a couple of textboxes just below it. When the user selects an option from the
dropdown, it triggers a postback event, which in-turn slightly adjusts the
remainder of the page.

The problem is that if the user is on a slow dial-up connection, they have
time to tab down below and start filling in the textboxes before the
postback mechanism kicks in and submits the form to the server. From the
user perspective, they've selected a value from the dropdown and now they
are typing along in the textbox, and all of the sudden the page posts back.
What I would like to do is add "document.body. disabled = true;" that will
execute immediately when the postback mechanism is started. I can get this
idea working great when the postback is caused by something like a button
and I use the RegisterOnSubmi tStatement method of the page class, but the
AutoPostBack feature of the dropdown list bypasses the client-side onsubmit event (this is a know/intended "issue").

What I'm wondering if there is a way to influence the output of the
__doPostBack script that my page is rendering out? Ideally, I could just add my disable script right there in the beginning of that script and everything would work great.

If anybody has any ideas on this, please let me know.

Thanks,
Chris

Nov 17 '05 #2

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

Similar topics

14
7196
by: Sinity | last post by:
Anyone knows the method/codes to disable the clicked button after first click by using .aspx-- to prevent people to click many time when waiting for the server response. I tried to do this by adding a java script for the button. But, useless.. Please help! Thank you
6
9078
by: Al Cohen | last post by:
I'm using a LinkButton to call some code, then do a redirect. The code does some queries, sends some emails, and takes a few moments before the redirect is performed. I'd like to disable my LinkButton during this period to prevent multiple submissions. (Obviously) the disabling should be done at the client side to prevent any delay. I've tried adding some javascript to LinkButton.Attributes: LinkButton1.Attributes.Add("onclick",...
4
4278
by: Jiho Han | last post by:
What is the best way to check whether the page is simply a postback or the form has been submit with the intention of doing something? In the olden days, I used to check for a form field name used for the submit button: <input type="submit" name="saverecord" value="push me to save"> Then I'd retrieve it using something like:
6
4053
by: GD | last post by:
Hi, I wonder how to disable the "submit" behavior of a button. What I want is to assign values to dynamically added user controls without page postback. Problem: dynamically created control can not be accessed because the button click trigers page postback(see sample code). When the button is clicked, an error occurs: "System.NullReferenceException: Object reference not set to an instance of an object." Please help. Thanks.
2
5933
by: Fluxray | last post by:
--Background: I have a webform including a datagrid. The datagrid is using template. Its ItemTemplate is used to display a look-up-table with labels. its EditItemTemplate is used to edit a row in the look-up-table with textboxes. I have a linkbutton in each row (causevalidation = false) named 'Edit' to post the page back such that the page is switch from display mode to edit mode (labels -> textboxes for the row to be edited), and the...
9
24173
by: junlia | last post by:
Does anyone how how can we disable the auto-postback feature in asp.net page? I have to use a server side control in the page, but the auto post back feature in it causes problems for me. Please help! Thanks much, Junlia
10
7067
by: Geoff | last post by:
Is there any way to change the enabled property of a dropdownlist without a postback, depending on the selection in another dropdownlist? Select Case ddlReport.SelectedValue Case "Profit" ddlFormat.Enabled = True Case "Trial Balance"
2
565
by: Larry | last post by:
Is there a way to disable all the controls the instant any auto-postback controls are changed (resulting in a postback that takes a couple seconds), so that the user can't continue changing other controls while the postback to the server is running? The reason this is necessary is because the user can be fooled into not knowing that the browser has posted-back to the server (he doesn't see the little blue progress bar at the bottom of...
2
1723
by: sonic | last post by:
I realize that if a field is disabled, its value will not be posted to server. i realize that .Enabled = false, produces disabled="disabled" markup i still don't see a good way to disable a field using javascript and than check for that on the server. if i render a regular textbox <asp:Textbox id="txt" runat="server" /> than on client do:
0
9707
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10082
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.