473,396 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

single-click button / ajax

Hi,
anyone know how to write a single-cilick button? [after click button
is being disabled while the method is executing]

I use this:

<asp:button id="ButtonAdd" runat="server" text="Anuluj"
onclick="Click_ButtonAdd" />

if ( !isPostBack){
ButtonAdd.Attributes.Add("onclick",
ClientScript.GetPostBackEventReference(ButtonAdd, "") +
";this.value='Processing Credit Card Payment...';this.disabled =
true;");

}

and I have with this a big problem.

For time to time this method is executing 2 times. I dont know why.
Instend of add 1 record to database it add 2 records.

Feb 27 '08 #1
5 1933
<la*****@gmail.comwrote in message
news:f8**********************************@o77g2000 hsf.googlegroups.com...
anyone know how to write a single-cilick button? [after click button
is being disabled while the method is executing]
<asp:Button ID="ButtonAdd" runat="server" Text="Anuluj"
OnClick="Click_ButtonAdd"
OnClientClick="this.value='Processing Credit Card
Payment...';this.disabled=true;" />
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Feb 27 '08 #2
<asp:Button ID="ButtonAdd" runat="server" Text="Anuluj"
OnClick="Click_ButtonAdd"
OnClientClick="this.value='Processing Credit Card
Payment...';this.disabled=true;" />

ok but now, method: Click_ButtonAdd is not executing :|
Feb 27 '08 #3
OnClientClick="this.value='Processing Credit Card
Payment...';this.disabled=true;return true;" />

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<la*****@gmail.comwrote in message
news:79**********************************@j28g2000 hsj.googlegroups.com...
>
><asp:Button ID="ButtonAdd" runat="server" Text="Anuluj"
OnClick="Click_ButtonAdd"
OnClientClick="this.value='Processing Credit Card
Payment...';this.disabled=true;" />


ok but now, method: Click_ButtonAdd is not executing :|

Feb 27 '08 #4
On 27 Lut, 13:55, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
OnClientClick="this.value='Processing Credit Card
Payment...';this.disabled=true;return true;" />
the same :( "return true;" didnt help
:(
Feb 27 '08 #5
disabling after postback is trival.

<asp:button id="ButtonAdd"
runat="server"
text="Anuluj"
onclientclick="window.setTimeout(function(){this.d isabled=true;};"
onclick="Click_ButtonAdd" />

but its a bad solution. if the postback takes too long and the user hits f5
(refresh), you will get a second postback. you should code for double
postbacks. render a transaction guid in a hidden field (or viewstate). then
store the guid with the payment posting. your code can then check if its been
processed, and display the proper response.

-- bruce (sqlwork.com)
"la*****@gmail.com" wrote:
Hi,
anyone know how to write a single-cilick button? [after click button
is being disabled while the method is executing]

I use this:

<asp:button id="ButtonAdd" runat="server" text="Anuluj"
onclick="Click_ButtonAdd" />

if ( !isPostBack){
ButtonAdd.Attributes.Add("onclick",
ClientScript.GetPostBackEventReference(ButtonAdd, "") +
";this.value='Processing Credit Card Payment...';this.disabled =
true;");

}

and I have with this a big problem.

For time to time this method is executing 2 times. I dont know why.
Instend of add 1 record to database it add 2 records.

Feb 27 '08 #6

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

Similar topics

5
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to...
12
by: Dennis Plöger | last post by:
Hi all! I'm currently having some problems parsing a char array in c++. (And yes, I'm a half-newbie ;-)) Perhaps you can help me with this: #include <iostream> using std::cout; void...
4
by: Venkat | last post by:
Hi All, I need to copy strings from a single dimensional array to a double dimensional array. Here is my program. #include <stdio.h> #include <stdlib.h>
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
2
by: John Dann | last post by:
I'm retrieving some columns from a database with numeric values that fall comfortably within the range of the Single type and I'm tempted to use Single for the relevant column type in the retrieved...
13
by: Kevin Walzer | last post by:
Which of the Windows/Unix package builders for Python applications is capable of creating single-file executables? I'm thinking of: 1. py2exe 2. Mcmillan Installer/PyInstaller 3. cxfreeze ...
7
by: ashley.ward | last post by:
We have been using VB6 to develop small custom apps that access an Oracle database, in order to extend a larger product that is developed by our colleagues in Germany (who use C++ and Java). As...
3
by: Eric Layman | last post by:
Hi, I've saved data into the db by doing a replace() on single quote. Right now on data display on a datagrid, it shows double single quote. How do I make changes during run time of datagrid...
2
by: Reporter | last post by:
I got the following example from http://www.evolt.org/article/User_Friendly_Forms_in_PHP/20/60144/index.html : echo '<tr><td>First name:</td><td><input type="text" name="first_name"...
0
by: Atos | last post by:
SINGLE-LINKED LIST Let's start with the simplest kind of linked list : the single-linked list which only has one link per node. That node except from the data it contains, which might be...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
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,...
0
jinu1996
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...
0
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...
0
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...
0
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,...

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.