I'm using a LinkButton to call some code, then do a redirect. The code
does some queries, sends some emails, and takes a few moments before the
redirect is performed.
I'd like to disable my LinkButton during this period to prevent multiple
submissions. (Obviously) the disabling should be done at the client
side to prevent any delay. I've tried adding some javascript to
LinkButton.Attributes:
LinkButton1.Attributes.Add("onclick", "this.href='javascript:void(0)'"
+ this.GetPostBackEventReference(this.LinkButton1));
but this doesn't disable the LinkButton. I also tried:
LinkButton1.Attributes.Add("onclick", "this.href='javascript:void(0)'");
which disables the link, but never does the postback.
This seems like a very important thing to be able to do, and thus it
should be reasonably easy - what am I missing?
Alternatively, perhaps there's something clever that I can do on the
server side to "short circuit" subsequent postbacks?
Thanks,
Al Cohen 6 8973
Hi Al,
I've had that same issue. Usually you have to attach the script code to the
form's OnSubmit().
Actually what I found is that if you disable the button that you're binding
events to the button's event doesn't fire because the button doesn't show up
in the post variable list. Hiding the button actually works better.
I usually do this in the HTML but you should be able to do the same with
attributes:
<form id="frmOrderForm"
onsubmit="this.btnSubmit.style.display='none';docu ment.getElementById('WaitN
ote').style.display='inline';return true;" ... >
This code hides the button and shows an area that has a message.
Works real well, except that I have an animated Gif in there and it doesn't
animate - some bug in IE related to a hidden image not animating, it works
with Mozilla...
+++ Rick ---
--
Rick Strahl
West Wind Technologies http://www.west-wind.com/ http://www.west-wind.com/blog/
----------------------------------
Making waves on the Web
"Al Cohen" <am***@no.junk.c-o-r-n-e-l-l.edu> wrote in message
news:DM********************@speakeasy.net... I'm using a LinkButton to call some code, then do a redirect. The code does some queries, sends some emails, and takes a few moments before the redirect is performed.
I'd like to disable my LinkButton during this period to prevent multiple submissions. (Obviously) the disabling should be done at the client side to prevent any delay. I've tried adding some javascript to LinkButton.Attributes:
LinkButton1.Attributes.Add("onclick", "this.href='javascript:void(0)'" + this.GetPostBackEventReference(this.LinkButton1));
but this doesn't disable the LinkButton. I also tried:
LinkButton1.Attributes.Add("onclick", "this.href='javascript:void(0)'");
which disables the link, but never does the postback.
This seems like a very important thing to be able to do, and thus it should be reasonably easy - what am I missing?
Alternatively, perhaps there's something clever that I can do on the server side to "short circuit" subsequent postbacks?
Thanks,
Al Cohen
Hi,
a solution that allways works, even if the user presses F5, or disables
javascript
I normaly insert a database value (ID, Identity) in a hidden form, when the
"updating" or other stuff takes place, it first checks if the value (ID) is
in the database, if it is there updating takes place and the ID is deleted,
if it is NOT there i tell the user that their data is allready saved,
problerly because they hit the submit button twice...
Regards,
Agge
"Rick Strahl [MVP]" <ri********@hotmail.com> skrev i en meddelelse
news:%2****************@TK2MSFTNGP10.phx.gbl... Hi Al,
I've had that same issue. Usually you have to attach the script code to
the form's OnSubmit().
Actually what I found is that if you disable the button that you're
binding events to the button's event doesn't fire because the button doesn't show
up in the post variable list. Hiding the button actually works better.
I usually do this in the HTML but you should be able to do the same with attributes:
<form id="frmOrderForm"
onsubmit="this.btnSubmit.style.display='none';docu ment.getElementById('WaitN ote').style.display='inline';return true;" ... >
This code hides the button and shows an area that has a message.
Works real well, except that I have an animated Gif in there and it
doesn't animate - some bug in IE related to a hidden image not animating, it works with Mozilla...
+++ Rick ---
--
Rick Strahl West Wind Technologies http://www.west-wind.com/ http://www.west-wind.com/blog/ ---------------------------------- Making waves on the Web
"Al Cohen" <am***@no.junk.c-o-r-n-e-l-l.edu> wrote in message news:DM********************@speakeasy.net... I'm using a LinkButton to call some code, then do a redirect. The code does some queries, sends some emails, and takes a few moments before the redirect is performed.
I'd like to disable my LinkButton during this period to prevent multiple submissions. (Obviously) the disabling should be done at the client side to prevent any delay. I've tried adding some javascript to LinkButton.Attributes:
LinkButton1.Attributes.Add("onclick", "this.href='javascript:void(0)'" + this.GetPostBackEventReference(this.LinkButton1));
but this doesn't disable the LinkButton. I also tried:
LinkButton1.Attributes.Add("onclick", "this.href='javascript:void(0)'");
which disables the link, but never does the postback.
This seems like a very important thing to be able to do, and thus it should be reasonably easy - what am I missing?
Alternatively, perhaps there's something clever that I can do on the server side to "short circuit" subsequent postbacks?
Thanks,
Al Cohen
Yes that is good practice. I think a more general approach should be taken
to this sort of thing, where your code should set something right away that
in teh DB that lets it know that the process has already started.
But I still think from a UI perspective it's smart to use something on the
client side to disable the button.
--
Rick Strahl
West Wind Technologies http://www.west-wind.com/ http://www.west-wind.com/blog/
----------------------------------
Making waves on the Web
"A" <ne**@agge.dk> wrote in message
news:ee**************@TK2MSFTNGP12.phx.gbl... Hi, a solution that allways works, even if the user presses F5, or disables javascript
I normaly insert a database value (ID, Identity) in a hidden form, when
the "updating" or other stuff takes place, it first checks if the value (ID)
is in the database, if it is there updating takes place and the ID is
deleted, if it is NOT there i tell the user that their data is allready saved, problerly because they hit the submit button twice...
Regards,
Agge
"Rick Strahl [MVP]" <ri********@hotmail.com> skrev i en meddelelse news:%2****************@TK2MSFTNGP10.phx.gbl... Hi Al,
I've had that same issue. Usually you have to attach the script code to the form's OnSubmit().
Actually what I found is that if you disable the button that you're binding events to the button's event doesn't fire because the button doesn't
show up in the post variable list. Hiding the button actually works better.
I usually do this in the HTML but you should be able to do the same with attributes:
<form id="frmOrderForm"
onsubmit="this.btnSubmit.style.display='none';docu ment.getElementById('WaitN ote').style.display='inline';return true;" ... >
This code hides the button and shows an area that has a message.
Works real well, except that I have an animated Gif in there and it doesn't animate - some bug in IE related to a hidden image not animating, it
works with Mozilla...
+++ Rick ---
--
Rick Strahl West Wind Technologies http://www.west-wind.com/ http://www.west-wind.com/blog/ ---------------------------------- Making waves on the Web
"Al Cohen" <am***@no.junk.c-o-r-n-e-l-l.edu> wrote in message news:DM********************@speakeasy.net... I'm using a LinkButton to call some code, then do a redirect. The
code does some queries, sends some emails, and takes a few moments before
the redirect is performed.
I'd like to disable my LinkButton during this period to prevent
multiple submissions. (Obviously) the disabling should be done at the client side to prevent any delay. I've tried adding some javascript to LinkButton.Attributes:
LinkButton1.Attributes.Add("onclick", "this.href='javascript:void(0)'" + this.GetPostBackEventReference(this.LinkButton1));
but this doesn't disable the LinkButton. I also tried:
LinkButton1.Attributes.Add("onclick",
"this.href='javascript:void(0)'"); which disables the link, but never does the postback.
This seems like a very important thing to be able to do, and thus it should be reasonably easy - what am I missing?
Alternatively, perhaps there's something clever that I can do on the server side to "short circuit" subsequent postbacks?
Thanks,
Al Cohen
How can I stop the linkbutton at a step, and then makes it go on to he
next step????
I dont really understand what you are trying to ask, but as far as I can
guess, you want to disable a link button without postback?
Here is something I did long time ago, I put the linkbutton in a div tag and
used javascript to show and hide it without postback..
Does this suite ur situation?
Hth...
R. Thomas
"Mr.Joe" wrote: How can I stop the linkbutton at a step, and then makes it go on to he next step????
please elaborate your question. It is very unclear.
"Mr.Joe" <yo***********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com... How can I stop the linkbutton at a step, and then makes it go on to he next step???? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: sef |
last post by:
i have a server-side script that executes this:
linkbutton1.Attributes.Add("onClick", "linkClicked();");
the client-side code has an html image...
|
by: Dave |
last post by:
Hi,
I have a datagrid with a Templated column below. I want to execute some javascript before the postback to show a hidden "div" tag with static...
|
by: Bharat |
last post by:
Hi Folks,
Suppose I have two link button on a page (say lnkBtn1 and
lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically...
|
by: Rob Meade |
last post by:
Hi all,
I have a bit of code that programmatically adds some table cells/rows to a
table.
The last cell adds a LinkButton control, I call it...
|
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...
|
by: Vi |
last post by:
Hi,
I'm trying to dinamically add LinkButton Controls to a web form. I do
something like:
for(i=1;i<=someVariable;i++)
{
LinkButton PageLink =...
|
by: geronimi |
last post by:
I want to create a linkbutton in a cell because not every row needs one
(so I can't setup a linkbuttoncolumn instead of a boundcolumn.)
First, i...
|
by: rn5a |
last post by:
In a shopping cart app, suppose a user has placed 5 orders, I want to
show him 5 LinkButtons (one for each order) so that when he clicks the
first...
|
by: darrel |
last post by:
Is it possible to pre-empt the javascript function used to do a postback
from a linkbutton?
I'd like to use linkbutton to delete a record and...
|
by: tammygombez |
last post by:
Hey fellow JavaFX developers,
I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
|
by: tammygombez |
last post by:
Hey everyone!
I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
| |