473,545 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

disabling controls during the postback...

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) where the user may be oblivious and could
say, press the button twice, or even fill in some more data on the form...

When the postback completes, any data entered in during this delay is lost.

How do I, when the user clicks on a button, process that event and then
disable the controls instantly so no more things can be done until the
postback is complete?

If you do it client side, surely the turning it off will disable the server
side event from being processed?
If you do it server side, then you have to wait for the postback cycle, and
this sort of makes the whole thing pointless.

Thanks.

Dan.
Nov 18 '05 #1
4 2341
What about simply disabling the button onclick?

btn.Attributes. Add("onClick", "this.disab led = true;");

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Dan =o)" <danielbass [at] postmaster [dot] co [dot] uk> wrote in message
news:Ol******** ******@TK2MSFTN GP09.phx.gbl...
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) where the user may be oblivious and could say, press the button twice, or even fill in some more data on the form...

When the postback completes, any data entered in during this delay is lost.
How do I, when the user clicks on a button, process that event and then
disable the controls instantly so no more things can be done until the
postback is complete?

If you do it client side, surely the turning it off will disable the server side event from being processed?
If you do it server side, then you have to wait for the postback cycle, and this sort of makes the whole thing pointless.

Thanks.

Dan.

Nov 18 '05 #2
Karl,

Unfortunately not...

For two reasons:
- the first is that performing this action then prevents the server side
event from firing and so there is no postback, and therefore no execution of
the code attached to the button...
- the second this is only one control, i want to "disable" the whole screen
while this is happening so the user cannot inadvertantly added more data in
the postback period.

Thanks.

Dan.

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:u$******** ******@TK2MSFTN GP09.phx.gbl...
What about simply disabling the button onclick?

btn.Attributes. Add("onClick", "this.disab led = true;");

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Dan =o)" <danielbass [at] postmaster [dot] co [dot] uk> wrote in message
news:Ol******** ******@TK2MSFTN GP09.phx.gbl...
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) where the user may be oblivious and

could
say, press the button twice, or even fill in some more data on the
form...

When the postback completes, any data entered in during this delay is

lost.

How do I, when the user clicks on a button, process that event and then
disable the controls instantly so no more things can be done until the
postback is complete?

If you do it client side, surely the turning it off will disable the

server
side event from being processed?
If you do it server side, then you have to wait for the postback cycle,

and
this sort of makes the whole thing pointless.

Thanks.

Dan.


Nov 18 '05 #3
Hi

I use a javascript code to do this job. I don't know if this is the simplest
solution but it's really working.

make a js file in which put javascript like this

function DisableControls (){
document.body.s tyle.cursor = "wait";
nr = document.forms[0].all.length;
for(i=0;i<nr;i+ +){
if(document.for ms[0].all(i).tagName == "SELECT" ||
(document.forms[0].all(i).tagName == "INPUT" &&
(document.forms[0].all(i).type == "radio" || document.forms[0].all(i).type ==
"checkbox" || document.forms[0].all(i).type == "button") ))
document.forms[0].all(i).disable d = true;
}
}

In your code behind attach event onbeforeunload with this king of code
RegisterStartup Script("onbefor eunload", "<script
language=\"Java Script\">window .attachEvent(\" onbeforeunload\ ",function
(){DisableContr ols()});</script>");

and also attachjs file with this

RegisterClientS criptBlock("Inc lude", "<script language=\"Java script\" src=\"
Scripts/Common.js\"></script>");

Hope this helps.

"Dan =o)" wrote:
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) where the user may be oblivious and could
say, press the button twice, or even fill in some more data on the form...

When the postback completes, any data entered in during this delay is lost.

How do I, when the user clicks on a button, process that event and then
disable the controls instantly so no more things can be done until the
postback is complete?

If you do it client side, surely the turning it off will disable the server
side event from being processed?
If you do it server side, then you have to wait for the postback cycle, and
this sort of makes the whole thing pointless.

Thanks.

Dan.

Nov 18 '05 #4
PERFECT!

Thanks for that.

"Psycho" <Ps****@discuss ions.microsoft. com> wrote in message
news:7D******** *************** ***********@mic rosoft.com...
Hi

I use a javascript code to do this job. I don't know if this is the
simplest
solution but it's really working.

make a js file in which put javascript like this

function DisableControls (){
document.body.s tyle.cursor = "wait";
nr = document.forms[0].all.length;
for(i=0;i<nr;i+ +){
if(document.for ms[0].all(i).tagName == "SELECT" ||
(document.forms[0].all(i).tagName == "INPUT" &&
(document.forms[0].all(i).type == "radio" || document.forms[0].all(i).type
==
"checkbox" || document.forms[0].all(i).type == "button") ))
document.forms[0].all(i).disable d = true;
}
}

In your code behind attach event onbeforeunload with this king of code
RegisterStartup Script("onbefor eunload", "<script
language=\"Java Script\">window .attachEvent(\" onbeforeunload\ ",function
(){DisableContr ols()});</script>");

and also attachjs file with this

RegisterClientS criptBlock("Inc lude", "<script language=\"Java script\"
src=\"
Scripts/Common.js\"></script>");

Hope this helps.

"Dan =o)" wrote:
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) where the user may be oblivious and
could
say, press the button twice, or even fill in some more data on the
form...

When the postback completes, any data entered in during this delay is
lost.

How do I, when the user clicks on a button, process that event and then
disable the controls instantly so no more things can be done until the
postback is complete?

If you do it client side, surely the turning it off will disable the
server
side event from being processed?
If you do it server side, then you have to wait for the postback cycle,
and
this sort of makes the whole thing pointless.

Thanks.

Dan.

Nov 18 '05 #5

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

Similar topics

8
4265
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue which is related to the repeater. In the code shown below, if I call Repeater1.Controls.Count in the OnInit (the code fragment was highlighted in...
1
2662
by: Scott Schluer | last post by:
Hello, I've got myself a small problem and I'm hoping someone can help. I have a DataList called dlProducts (displays products from a database). Within the <ItemTemplate> container of the DataList, I have a PlaceHolder control called phVariations. During the ItemDataBound event for dlProducts, I dynamically create a few DropDownLists...
2
4982
by: Sam | last post by:
I have a custom control (MyTextBox - taken from Microsoft website) that implements the IPostBackDataHandler interface. It is added to the controls collection of a placeholder control during the Page Load of a main ASPX page. Now if we debug the MyTextBox, we find the order of events like so (during a Posback, of course): OnInit -> OnLoad ->...
6
5996
by: Glenn Owens | last post by:
I have an ASP.Net page on which there are serveral static controls (listboxes, radiobuttonlist and textboxes). These controls are used to create criteria from which the code-behind will dynamically create 1-n datagrids. When the Submit button is clicked I need to save (in viewstate) the contents of the criteria controls so that I can...
6
2545
by: sonic | last post by:
Hi, I am experimenting with different viewstate management ideas for large datagrids, and found a microsoft suggestion to turn it off, and only store relevant information by manually accessing viewstate. as per some helpful suggestins in MSDN "Common DataGrid Mistakes"...
22
2154
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said stage. One approach I have used on other systems is to prevent the action buttons appearing. For example, if one did not have the Role of...
2
2114
by: Raymond Du | last post by:
Hi, I need to find a way to place multiple textboxes and other controls dynamically on a web form, I tried to put a placeholder on a form then create and add controls dynamically into the place holder. It is not working, all controls added disappear after the postback. I tried to find a working sample on Internet with no lucks, some...
0
1828
JimWu
by: JimWu | last post by:
I have some problems in my code. The stutiation illustrate as the followsing statement. I use two pages, one, named "upload.aspx", is including several general html input tag, whose type are "file". That mean I create server file upload controls in this page. After user choose their files, wanted to upload, and click upload button, this...
0
3112
by: wfsmith | last post by:
I have a page with a MultiView control and 6 Views. Each view has a User control that contains various form controls (dropdowns, textboxes and CascadingDropDown Ajax.Net controls). When the page is loaded, I populate the various form controls with data inside each of the 6 Views by accessing my exposed properties of my User Control. All...
0
7486
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...
0
7676
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. ...
1
7442
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7776
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...
0
6001
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4965
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...
0
3473
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...
1
1905
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
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.