Hello,
In an aspx page i have webform with some textboxes and a simple
button. When the button is clicked, there is a postback and then the
code in the click event of the button is executed.
However in this code (click event of the button), i'm processing an
online payment, which takes about 5 seconds. While waiting for the
payment to be processed, the user can click again on the button, and
this is what i want to block. I want to disable the button once
clicked, and then execute the code for the web payment.
However when we disable a button in the Load event, the page is only
displayed after the Unload event, so the button still appears as
enabled when executing the code in the click event of the button.
I tried to call a javascript function on the onclick of the button to
disable it but i get a compilation error at runtime. Is there a way to
disable a webform button when clicked, then execute the code on the
Click event of this button? The button needs to appear as disabled on
the page before the code is executed.
Thanks for any help! 7 1463
Even if you disable the button you'll likely have the same problem if the
person refreshes their browser.
To solve this problem, you can generate a unique id for that web page
instance.
If you detect that unique id being posted more than once, then ignore the
subsequent reposts.
Here's a good article on the subject: http://www.aspnetpro.com/features/20...200309de_f.asp
--
I hope this helps,
Steve C. Orr, MCSD http://Steve.Orr.net
"Matt" <me***@rocks.com> wrote in message
news:si********************************@4ax.com... Hello,
In an aspx page i have webform with some textboxes and a simple button. When the button is clicked, there is a postback and then the code in the click event of the button is executed.
However in this code (click event of the button), i'm processing an online payment, which takes about 5 seconds. While waiting for the payment to be processed, the user can click again on the button, and this is what i want to block. I want to disable the button once clicked, and then execute the code for the web payment.
However when we disable a button in the Load event, the page is only displayed after the Unload event, so the button still appears as enabled when executing the code in the click event of the button.
I tried to call a javascript function on the onclick of the button to disable it but i get a compilation error at runtime. Is there a way to disable a webform button when clicked, then execute the code on the Click event of this button? The button needs to appear as disabled on the page before the code is executed.
Thanks for any help!
I had this problem with an authentication page where authenticating the user
took a few seconds and I didn't want them to keep clicking. Basically you
have to do 2 things with 1 click... something to visually alter the screen,
and then handle the actual click in your c/vb.net code.
Make a javascript block to do whatever you need to do on the client when
they click the button. In the example, js renders the button "hidden".
<Script Language="JavaScript">
function clickHandler()
{
frmLogin.btnLogin.style.visibility = 'hidden';
}
</Script>
In my html, here's the submit button the user clicks:
<form ID="frmLogin" runat="server">
<asp:Button ID="btnLogin" class="button" text="Log In"
onclick="Login_Click" Runat="server" />
</form>
Now in Sub page_load, you need a call to RegisterOnSubmitStatement. This,
afaik, tells asp.net to run the js function specified then handle the click
event in asp.net:
Sub Page_Load(s As Object, e As EventArgs)
RegisterOnSubmitStatement("submit", "clickHandler();")
'...code
So when the user clicks btnLogin on my form, RegisterOnSubmitStatement calls
the javascript that hides the button, and then my vb.net routine called
"Login_Click" would run. 2 routines for the price of 1 click.
You can augment the functionality of the clickHandler(); js routine to
display a please wait message, etc. Just don't damage the integrity of the
button object from the js code or the codebehind handling the button event
may fail. For example, I believe this code breaks if you 'disable' the
button or remove it completely. Hiding it is safe, and certainly renders
the button un-clickable for the remainder of the page life.
HTH
"Matt" <me***@rocks.com> wrote in message
news:si********************************@4ax.com... Hello,
In an aspx page i have webform with some textboxes and a simple button. When the button is clicked, there is a postback and then the code in the click event of the button is executed.
However in this code (click event of the button), i'm processing an online payment, which takes about 5 seconds. While waiting for the payment to be processed, the user can click again on the button, and this is what i want to block. I want to disable the button once clicked, and then execute the code for the web payment.
However when we disable a button in the Load event, the page is only displayed after the Unload event, so the button still appears as enabled when executing the code in the click event of the button.
I tried to call a javascript function on the onclick of the button to disable it but i get a compilation error at runtime. Is there a way to disable a webform button when clicked, then execute the code on the Click event of this button? The button needs to appear as disabled on the page before the code is executed.
Thanks for any help!
I tried to run your code and I am getting errors
'ASP.WebForm1_aspx' does not contain a definition for 'Login_Click'
???
"eruess" <er****@r.com> wrote in message
news:PI********************@speakeasy.net... I had this problem with an authentication page where authenticating the
user took a few seconds and I didn't want them to keep clicking. Basically you have to do 2 things with 1 click... something to visually alter the
screen, and then handle the actual click in your c/vb.net code.
Make a javascript block to do whatever you need to do on the client when they click the button. In the example, js renders the button "hidden".
<Script Language="JavaScript"> function clickHandler() { frmLogin.btnLogin.style.visibility = 'hidden'; } </Script>
In my html, here's the submit button the user clicks:
<form ID="frmLogin" runat="server"> <asp:Button ID="btnLogin" class="button" text="Log In" onclick="Login_Click" Runat="server" /> </form>
Now in Sub page_load, you need a call to RegisterOnSubmitStatement. This, afaik, tells asp.net to run the js function specified then handle the
click event in asp.net:
Sub Page_Load(s As Object, e As EventArgs) RegisterOnSubmitStatement("submit", "clickHandler();") '...code
So when the user clicks btnLogin on my form, RegisterOnSubmitStatement
calls the javascript that hides the button, and then my vb.net routine called "Login_Click" would run. 2 routines for the price of 1 click.
You can augment the functionality of the clickHandler(); js routine to display a please wait message, etc. Just don't damage the integrity of
the button object from the js code or the codebehind handling the button event may fail. For example, I believe this code breaks if you 'disable' the button or remove it completely. Hiding it is safe, and certainly renders the button un-clickable for the remainder of the page life.
HTH
"Matt" <me***@rocks.com> wrote in message news:si********************************@4ax.com... Hello,
In an aspx page i have webform with some textboxes and a simple button. When the button is clicked, there is a postback and then the code in the click event of the button is executed.
However in this code (click event of the button), i'm processing an online payment, which takes about 5 seconds. While waiting for the payment to be processed, the user can click again on the button, and this is what i want to block. I want to disable the button once clicked, and then execute the code for the web payment.
However when we disable a button in the Load event, the page is only displayed after the Unload event, so the button still appears as enabled when executing the code in the click event of the button.
I tried to call a javascript function on the onclick of the button to disable it but i get a compilation error at runtime. Is there a way to disable a webform button when clicked, then execute the code on the Click event of this button? The button needs to appear as disabled on the page before the code is executed.
Thanks for any help!
Got it. Sorry I did not provide the Login_Click Sub in code Behind
"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message
news:uj**************@tk2msftngp13.phx.gbl... I tried to run your code and I am getting errors 'ASP.WebForm1_aspx' does not contain a definition for 'Login_Click'
???
"eruess" <er****@r.com> wrote in message news:PI********************@speakeasy.net... I had this problem with an authentication page where authenticating the user took a few seconds and I didn't want them to keep clicking. Basically
you have to do 2 things with 1 click... something to visually alter the screen, and then handle the actual click in your c/vb.net code.
Make a javascript block to do whatever you need to do on the client when they click the button. In the example, js renders the button "hidden".
<Script Language="JavaScript"> function clickHandler() { frmLogin.btnLogin.style.visibility = 'hidden'; } </Script>
In my html, here's the submit button the user clicks:
<form ID="frmLogin" runat="server"> <asp:Button ID="btnLogin" class="button" text="Log In" onclick="Login_Click" Runat="server" /> </form>
Now in Sub page_load, you need a call to RegisterOnSubmitStatement.
This, afaik, tells asp.net to run the js function specified then handle the click event in asp.net:
Sub Page_Load(s As Object, e As EventArgs) RegisterOnSubmitStatement("submit", "clickHandler();") '...code
So when the user clicks btnLogin on my form, RegisterOnSubmitStatement calls the javascript that hides the button, and then my vb.net routine called "Login_Click" would run. 2 routines for the price of 1 click.
You can augment the functionality of the clickHandler(); js routine to display a please wait message, etc. Just don't damage the integrity of the button object from the js code or the codebehind handling the button
event may fail. For example, I believe this code breaks if you 'disable' the button or remove it completely. Hiding it is safe, and certainly
renders the button un-clickable for the remainder of the page life.
HTH
"Matt" <me***@rocks.com> wrote in message news:si********************************@4ax.com... Hello,
In an aspx page i have webform with some textboxes and a simple button. When the button is clicked, there is a postback and then the code in the click event of the button is executed.
However in this code (click event of the button), i'm processing an online payment, which takes about 5 seconds. While waiting for the payment to be processed, the user can click again on the button, and this is what i want to block. I want to disable the button once clicked, and then execute the code for the web payment.
However when we disable a button in the Load event, the page is only displayed after the Unload event, so the button still appears as enabled when executing the code in the click event of the button.
I tried to call a javascript function on the onclick of the button to disable it but i get a compilation error at runtime. Is there a way to disable a webform button when clicked, then execute the code on the Click event of this button? The button needs to appear as disabled on the page before the code is executed.
Thanks for any help!
Login_Click is the name of a Sub in my code. You'll need to modify my post
to have it function within your own project. When the button is clicked, there is a postback and then the
code in the click event of the button is executed.
However in this code (click event of the button), i'm processing an
online payment, which takes about 5 seconds.<<
So then instead of trying to call my Login_Click (which doesn't exist in
your application) you'll want to call whatever sub does what you described
in the above paragraph... 'Button1_Click' or whatever you / vs.net may have
named it.
Bear in mind with my project, Login_Click did not Handle any control events
(such as clicking), and AutoEventWireUp was False. I have not tested this
thing in a situation where I'm directly calling the sub that also handles
the button's click.
"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message
news:uj**************@tk2msftngp13.phx.gbl... I tried to run your code and I am getting errors 'ASP.WebForm1_aspx' does not contain a definition for 'Login_Click'
???
Thanks, this is exactly what i was looking for! I also added some code
in the javascript function to show a layer, containing a message and
an animated gif acting like a progress bar.
However the gif stops when the web payment code is executed, so the
gif is useless. A flash animation works but i don't want to use flash
in this project.
But the essential is that it works, thanks!
On Thu, 7 Aug 2003 17:14:13 -0700, "eruess" <er****@r.com> wrote: I had this problem with an authentication page where authenticating the user took a few seconds and I didn't want them to keep clicking. Basically you have to do 2 things with 1 click... something to visually alter the screen, and then handle the actual click in your c/vb.net code.
Make a javascript block to do whatever you need to do on the client when they click the button. In the example, js renders the button "hidden".
<Script Language="JavaScript"> function clickHandler() { frmLogin.btnLogin.style.visibility = 'hidden'; } </Script>
In my html, here's the submit button the user clicks:
<form ID="frmLogin" runat="server"> <asp:Button ID="btnLogin" class="button" text="Log In" onclick="Login_Click" Runat="server" /> </form>
Now in Sub page_load, you need a call to RegisterOnSubmitStatement. This, afaik, tells asp.net to run the js function specified then handle the click event in asp.net:
Sub Page_Load(s As Object, e As EventArgs) RegisterOnSubmitStatement("submit", "clickHandler();") '...code
So when the user clicks btnLogin on my form, RegisterOnSubmitStatement calls the javascript that hides the button, and then my vb.net routine called "Login_Click" would run. 2 routines for the price of 1 click.
You can augment the functionality of the clickHandler(); js routine to display a please wait message, etc. Just don't damage the integrity of the button object from the js code or the codebehind handling the button event may fail. For example, I believe this code breaks if you 'disable' the button or remove it completely. Hiding it is safe, and certainly renders the button un-clickable for the remainder of the page life.
HTH
"Matt" <me***@rocks.com> wrote in message news:si********************************@4ax.com.. . Hello,
In an aspx page i have webform with some textboxes and a simple button. When the button is clicked, there is a postback and then the code in the click event of the button is executed.
However in this code (click event of the button), i'm processing an online payment, which takes about 5 seconds. While waiting for the payment to be processed, the user can click again on the button, and this is what i want to block. I want to disable the button once clicked, and then execute the code for the web payment.
However when we disable a button in the Load event, the page is only displayed after the Unload event, so the button still appears as enabled when executing the code in the click event of the button.
I tried to call a javascript function on the onclick of the button to disable it but i get a compilation error at runtime. Is there a way to disable a webform button when clicked, then execute the code on the Click event of this button? The button needs to appear as disabled on the page before the code is executed.
Thanks for any help!
Thank you, that is great
"eruess" <er****@r.com> wrote in message
news:NO********************@speakeasy.net... Login_Click is the name of a Sub in my code. You'll need to modify my
post to have it function within your own project.
When the button is clicked, there is a postback and then the code in the click event of the button is executed. However in this code (click event of the button), i'm processing an online payment, which takes about 5 seconds.<<
So then instead of trying to call my Login_Click (which doesn't exist in your application) you'll want to call whatever sub does what you described in the above paragraph... 'Button1_Click' or whatever you / vs.net may
have named it.
Bear in mind with my project, Login_Click did not Handle any control
events (such as clicking), and AutoEventWireUp was False. I have not tested this thing in a situation where I'm directly calling the sub that also handles the button's click.
"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message news:uj**************@tk2msftngp13.phx.gbl... I tried to run your code and I am getting errors 'ASP.WebForm1_aspx' does not contain a definition for 'Login_Click'
???
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: RAJ |
last post by:
In our multi-tier application, we have several ASP.NET user controls which
will update the same data source provided by middle tier logic.
In this particular scenario we have one user control...
|
by: walesboy |
last post by:
greetings -
I have a btnSubmit button with a Handles btnSubmit.click which works great
if all the user does is click that button.
But, if the user ALSO changes a text box on the page (which...
|
by: Shailya |
last post by:
We can try writing java script function which will change mouse pointr
to Hourglass of entire document.
Means we can write two functions
1)Change cursor to hourglass
2)change back to default.
...
|
by: Jim Hammond |
last post by:
It would be udeful to be able to get the current on-screen values from a
FormView that is databound to an ObjectDataSource by using a callback instead
of a postback. For example:
public void...
|
by: Timbo |
last post by:
Hi all,
This is my first message here so i'll try and include all the
information that will help you help me out, if possible.
Basically I am using C# in ASP.NET 2.0 and have a Repeater...
|
by: antonyliu2002 |
last post by:
I know that this has been asked and answered thousands of times. As a
matter of fact, I know that I need to say
If Not Page.IsPostBack Then
'Do something
End If
for things that needs to be...
|
by: Tony Girgenti |
last post by:
Hello.
I'm trying to undetrstand ASP.NET 2.0 and javascript.
When i have a button and i click on it and i see the web broswer progress
bar at the bottom do something, does that mean that there...
|
by: John Kotuby |
last post by:
Hi guys,
I am converting a rather complicated database driven Web application from
classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The
original ASP application works quite...
|
by: jpavel |
last post by:
Hello everyone. I'm having a problem with accessing components. I've looked
for a solution in other forums but until now no one have given me any tiny
clue about how could I solve it. I know there...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |