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. 4 2332
What about simply disabling the button onclick?
btn.Attributes.Add("onClick", "this.disabled = true;");
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"Dan =o)" <danielbass [at] postmaster [dot] co [dot] uk> wrote in message
news:Ol**************@TK2MSFTNGP09.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.
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$**************@TK2MSFTNGP09.phx.gbl... What about simply disabling the button onclick?
btn.Attributes.Add("onClick", "this.disabled = true;");
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/
"Dan =o)" <danielbass [at] postmaster [dot] co [dot] uk> wrote in message news:Ol**************@TK2MSFTNGP09.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.
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.style.cursor = "wait";
nr = document.forms[0].all.length;
for(i=0;i<nr;i++){
if(document.forms[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).disabled = true;
}
}
In your code behind attach event onbeforeunload with this king of code
RegisterStartupScript("onbeforeunload", "<script
language=\"JavaScript\">window.attachEvent(\" onbeforeunload\",function
(){DisableControls()});</script>");
and also attachjs file with this
RegisterClientScriptBlock("Include", "<script language=\"Javascript\" 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.
PERFECT!
Thanks for that.
"Psycho" <Ps****@discussions.microsoft.com> wrote in message
news:7D**********************************@microsof t.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.style.cursor = "wait"; nr = document.forms[0].all.length; for(i=0;i<nr;i++){ if(document.forms[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).disabled = true; } }
In your code behind attach event onbeforeunload with this king of code RegisterStartupScript("onbeforeunload", "<script language=\"JavaScript\">window.attachEvent(\" onbeforeunload\",function (){DisableControls()});</script>");
and also attachjs file with this
RegisterClientScriptBlock("Include", "<script language=\"Javascript\" 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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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...
| |