Click Once For LinkButton Not Working

Discussion in 'ASP .Net' started by xenophon, Jan 28, 2005.

  1. xenophon

    xenophon Guest

    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.
     
    xenophon, Jan 28, 2005
    #1
    1. Advertising

  2. xenophon

    bruce barker Guest

    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" <> wrote in message
    news:...
    |
    | 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.
    |
    |
     
    bruce barker, Jan 28, 2005
    #2
    1. Advertising

  3. 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/microsoft.public.dotnet.framework.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/microsoft.public.dotnet.framework.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.)
     
    Steven Cheng[MSFT], Jan 31, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sathyaish
    Replies:
    3
    Views:
    3,168
    Sathyaish
    Sep 8, 2005
  2. Mel
    Replies:
    6
    Views:
    571
  3. Sathyaish

    Linkbutton does not look like a linkbutton

    Sathyaish, Sep 8, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    215
    Sathyaish
    Sep 8, 2005
  4. Mike McAllister
    Replies:
    11
    Views:
    408
    Yan-Hong Huang[MSFT]
    Feb 21, 2006
  5. Waldy

    LinkButton Click Event does not fire

    Waldy, Jan 2, 2008, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    225
    Waldy
    Jan 2, 2008
Loading...

Share This Page