By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

single-click button / ajax

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
<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

P: n/a
<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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.