473,387 Members | 1,700 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,387 software developers and data experts.

Click Once For LinkButton Not Working


I am trying to add "click once" functionality to my ASP.NET page. I
have this attribute in my form tag:

onsubmit="return SubmitCheck()"
And I have the below in my <head> tag, but for some reason the click
never gets intercepted. What am I doing wrong?
<script language='javascript' type='text/javascript'>
<!--
function window_onload()
{
var __oldPostBack = __doPostBack;
__doPostBack = SubmitCheck;
}
// -->
</script>
<script language='javascript' type='text/javascript'>
<!--
var submitCount=0;
function SubmitCheck( eventTarget , eventArg )
{
if (submitCount == 0)
{
submitCount++;
return __oldPostBack(eventTarget , eventArg);
}
else
{
alert( submitCount + 'Please wait.');
}
}
// -->
</script>



Thanks.
Nov 19 '05 #1
2 1861
1) the onsubmit event won't fire for a linkbutton, only for submit buttons
or the enter key.
2) you don't show where you window_onload() routine is called, so probably
it isn't

-- bruce (sqlwork.com)
"xenophon" <xe******@online.nospam> wrote in message
news:j0********************************@4ax.com...
|
| I am trying to add "click once" functionality to my ASP.NET page. I
| have this attribute in my form tag:
|
| onsubmit="return SubmitCheck()"
|
|
| And I have the below in my <head> tag, but for some reason the click
| never gets intercepted. What am I doing wrong?
|
|
| <script language='javascript' type='text/javascript'>
| <!--
| function window_onload()
| {
| var __oldPostBack = __doPostBack;
| __doPostBack = SubmitCheck;
| }
| // -->
| </script>
| <script language='javascript' type='text/javascript'>
| <!--
| var submitCount=0;
| function SubmitCheck( eventTarget , eventArg )
| {
| if (submitCount == 0)
| {
| submitCount++;
| return __oldPostBack(eventTarget , eventArg);
| }
| else
| {
| alert( submitCount + 'Please wait.');
| }
| }
| // -->
| </script>
|
|
|
|
|
|
|
|
|
| Thanks.
|
|
Nov 19 '05 #2
Hi Xenophon,

I think Bruce's suggestion is reasonable ,the onsubmit won't be fire by all
the post back enabled controls. Instead of using the onsubmit event or
intercept the __doPostBack function, I think you can also consider just
disable the certain submit button after the user first time click it. Also,
the end user still can refresh the page to make multi post back submits. So
it is most important to also provide serverside transaction checking or
even in database level. Here are some tech articles and former threads
discussing on the similiar problem:

#How to prevent multiple clicks of a submit button in ASP.NET
http://aspzone.com/articles/207.aspx

http://groups-beta.google.com/group/...amework.aspnet
/browse_thread/thread/7743c065b33c241d/33c3f7f4cc5f79a5?q=asp.net+prevent+pa
ge+multiple+submit&_done=%2Fgroups%3Fhl%3Den%26lr% 3D%26q%3Dasp.net+prevent+p
age+multiple+submit%26&_doneTitle=Back+to+Search&& d#33c3f7f4cc5f79a5

http://groups-beta.google.com/group/...amework.aspnet
/browse_thread/thread/6fab6a8261900df3/2d7bf741ea8c2024?q=asp.net+prevent+pa
ge+multiple+submit&_done=%2Fgroups%3Fhl%3Den%26lr% 3D%26q%3Dasp.net+prevent+p
age+multiple+submit%26&_doneTitle=Back+to+Search&& d#2d7bf741ea8c2024
HTH.

Thanks & Regards,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #3

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

Similar topics

5
by: tshad | last post by:
I have been working with setting my drop boxes to allow double clicking to select an item. It worked fine until I made some changes. I then stripped the page down to the bare essentials to find...
1
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 create a linkbutton in the datagrid_ItemDataBound...
0
by: Demetri | last post by:
I have created a web control that can be rendered as either a linkbutton or a button. It is a ConfirmButton control that allows a developer to force a user to confirm if they intended to click it...
2
by: Chu | last post by:
Thanks everyone for taking a moment to read this. I've got a page where I use a LinkButton and I wire up a dynamic event to the button. When the user clicks the button, the event is fired as...
2
by: Hardy Wang | last post by:
Hi all, We have DataGrid control in Web Form, our client requires to be able to click anywhere of a row to fire the event same as LinkBotton column is clicked. We we did in ASP.NET 1.1 is in...
0
by: OceanBreeze | last post by:
I have added a LinkButton to a table cell programmatically inside the Page_Load method. I also added a custom event to that link button. The same custom event is valid for all the link buttons. The...
5
by: Amoril | last post by:
I've read quite a few different message on various boards and for some reason I'm still having trouble wrapping my head around this viewstate maintenance and trying to get these dynamically created...
6
by: Class | last post by:
Hi all, I create a gridview dynamicly because I don't know the columns in advance. I use the Templatefield to create a linkbutton. Everything fine..I have the postbackurl and it works. But now...
6
by: Mel | last post by:
I have a website that allows the user to generate a new quote. When they are finished creating the quote, it brings them to the final page (called the Goodbye.aspx page) which just states the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
0
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
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?
0
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...
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,...

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.