473,607 Members | 2,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disable web page controls during postback round-trip

We want to prevent user from being able to click on a button twice or
click on other controls while processing is going on. I tried the
following javascript code (which was suggested in this group but it
didn't really work). User can click on "print" button and then before
postback, they can click on "cancel" button. Any other suggestions?
function ignoreinput() (
return false;
}
function stop_input() {
window.attachEv ent(""onkeydown "", ignoreinput); " _
window.attachEv ent(""onclick"" , ignoreinput); " _
}
Then in the form element of the page add an onsubmit entry..

<form id="Form1" method="post" runat="server" onsubmit="stop_ input();">

Dec 10 '06 #1
2 4374
Hi,
Actually following sentence in your code needs to be corrected:
InCorrect :<form id="Form1" method="post" runat="server"
onsubmit="stop_ input();">
Correct One : <form id="Form1" method="post" runat="server" onsubmit="retur n
stop_input();">

Anyway two solutions provided in the following URL will surely solve your
probelm:
http://www.codersource.net/published...rocessing.aspx.

Thanks and regards,
manish bafna
"Sehboo" wrote:
We want to prevent user from being able to click on a button twice or
click on other controls while processing is going on. I tried the
following javascript code (which was suggested in this group but it
didn't really work). User can click on "print" button and then before
postback, they can click on "cancel" button. Any other suggestions?
function ignoreinput() (
return false;
}
function stop_input() {
window.attachEv ent(""onkeydown "", ignoreinput); " _
window.attachEv ent(""onclick"" , ignoreinput); " _
}
Then in the form element of the page add an onsubmit entry..

<form id="Form1" method="post" runat="server" onsubmit="stop_ input();">

Dec 10 '06 #2
Manish,

It didn't work. I am copying the header section from my page here -
maybe I am missing something

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD> <TITLE></TITLE>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<script language="JavaS cript">history. forward();
function ignoreinput()
{return false;}
function stop_input()
{
window.attachEv ent("onkeydown" , ignoreinput);
window.attachEv ent("onclick", ignoreinput);
}
</script>
</HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 BOTTOMMARGIN=0 RIGHTMARGIN=0
onLoad='javascr ipt:setDefaultB uttonScript()'>
<form name="_ctl16" method="post" action="MyPage. aspx"
language="javas cript" onsubmit="retur n stop_input();" id="_ctl16"
runat="server">

I have two buttons on this page, print and cancel. Print takes about
10 seconds to print the report and cancel just take you back to the
previous page. If I click on print and after two seconds, click on
cancel then it takes me back to the previous page. What I want is that
once user clicks on print, all the other controls should be disabled
(or ignored).

I haven't looked at the other examples on the link - if this doesn't
work then I will look into that.

thanks

Manish Bafna wrote:
Hi,
Actually following sentence in your code needs to be corrected:
InCorrect :<form id="Form1" method="post" runat="server"
onsubmit="stop_ input();">
Correct One : <form id="Form1" method="post" runat="server" onsubmit="retur n
stop_input();">

Anyway two solutions provided in the following URL will surely solve your
probelm:
http://www.codersource.net/published...rocessing.aspx.

Thanks and regards,
manish bafna
"Sehboo" wrote:
We want to prevent user from being able to click on a button twice or
click on other controls while processing is going on. I tried the
following javascript code (which was suggested in this group but it
didn't really work). User can click on "print" button and then before
postback, they can click on "cancel" button. Any other suggestions?
function ignoreinput() (
return false;
}
function stop_input() {
window.attachEv ent(""onkeydown "", ignoreinput); " _
window.attachEv ent(""onclick"" , ignoreinput); " _
}
Then in the form element of the page add an onsubmit entry..

<form id="Form1" method="post" runat="server" onsubmit="stop_ input();">
Dec 12 '06 #3

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

Similar topics

7
3513
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET) template. Briefly -------------------------------------------------------------------------------------------- I need to create dynamically some controls on the forms, and display these
2
4989
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 -> LoadPostData. My question is why does the LoadPostData occur *after* the OnLoad instead of...
2
3614
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
6
6003
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 recreate the dynamic DataGrid(s) in the LoadViewState (overloaded method). I need to do this so that the...
6
4034
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
5920
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...
0
1283
by: seven | last post by:
I have a base page with an HTMLForm object (added to the base page control heiarchy during Init). In the design of pages derived from this base page, I can choose to create controls and add them to the HTMLForm object I'm inheriting, to create a postback form. And on one particular page I'm doing just that; defining controls on the derived page (during Init) and adding these controls to the inherited HTMLForm object's control...
0
3358
by: Robert Ladd | last post by:
Hi, I'm trying to disable the asp.net calendar control from a javascript function, but it doesn't disable the doPostBack. To simplify the situation, assume a page with 4 controls. A dropdownlist, a calendar control, a textbox and an update button. What I'm doing is initially setting the button to disabled, the other 3 controls are enabled. If any data is entered in the textbox, I want to disable the dropdownlist and the calendar...
9
24150
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
0
1832
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 page will be postbacked to another page, called "edit.aspx". The code as follows. edit.aspx
0
8049
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
7985
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
8322
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
6803
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5471
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
3953
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
4013
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1316
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.