|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Preventing button code being run twiceI have a v2.0 site that has a form with a GO button which runs another
application and then returns some data which is then processed and then I issue a response.redirect to another form to display the returned data. My problem is that it is possible for a user to click the button several times causing the external app to run several times. My first thought was to set the button.enabled = false as soon as it is clicked but that does not work, presumably because of caching. What is the best way to stop this code executing more than once or until the page is opened again? Thanks Bill Can you set the caption of the button to something like "Processing..."
when it's clicked? Then when the user clicks the button if it equals "Processing..." do nothing. Bill wrote: Show quoteHide quote > I have a v2.0 site that has a form with a GO button which runs another > application and then returns some data which is then processed and then I > issue a response.redirect to another form to display the returned data. > > My problem is that it is possible for a user to click the button several > times causing the external app to run several times. > > My first thought was to set the button.enabled = false as soon as it is > clicked but that does not work, presumably because of caching. > > What is the best way to stop this code executing more than once or until > the page is opened again? > > Thanks > > Bill Otherwise, you could just disable the button after it has been clicked.
Use a variable that would change if the button had been clicked. Then if you needed the user to be able to click that same button again later, have another variable that would re-enable. Bill wrote: Show quoteHide quote > I have a v2.0 site that has a form with a GO button which runs another > application and then returns some data which is then processed and then I > issue a response.redirect to another form to display the returned data. > > My problem is that it is possible for a user to click the button several > times causing the external app to run several times. > > My first thought was to set the button.enabled = false as soon as it is > clicked but that does not work, presumably because of caching. > > What is the best way to stop this code executing more than once or until > the page is opened again? > > Thanks > > Bill Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click Response.Write("Write this line once!") Button1.Attributes.Add("onClick", _ "document.forms[0]." & Button1.UniqueID & ".disabled = true;") End Sub Bill wrote: Show quoteHide quote > I have a v2.0 site that has a form with a GO button which runs another > application and then returns some data which is then processed and then I > issue a response.redirect to another form to display the returned data. > > My problem is that it is possible for a user to click the button several > times causing the external app to run several times. > > My first thought was to set the button.enabled = false as soon as it is > clicked but that does not work, presumably because of caching. > > What is the best way to stop this code executing more than once or until > the page is opened again? > > Thanks > > Bill
VB.NET Express speed issue
To overload, or not to overload? ANN: VS.NET 2003 SP1 Newbie and 2005 Concurrecny MS Access Reports and VB.NET Program RE: TO LEARN PROGRAMMING Serial Port Communuciation in VB with Compact Framework 2.0 Memory Usange In VB.NET Desktop Application Culture Setting create a folder useing vb code? |
|||||||||||||||||||||||