How to Ignore a Asp:Button or asp:linkbutton click

Discussion in 'ASP .Net' started by RSB, May 13, 2004.

  1. RSB

    RSB Guest

    Hi

    I am executing a JavaScript Function for a Button and doing some custom data
    validation.
    Now i want to Ignore the Button Click if the Data validation Fails. i am
    using return(false) in the JavaScript Function but that does not work.

    Please help.
    Thanks
    RSB
    RSB, May 13, 2004
    #1
    1. Advertising

  2. Hi RSB,

    Have you tried adding a custom validator ?
    This best fits in this situation. Keep a custom validator and enable disable
    the CustomValidator based on the Data validation you are doing.
    PS: You may also need to add the Serverside code also for the
    customvalidatior.

    Regards
    Ashish M Bhonkiya



    "RSB" <> wrote in message
    news:MHLoc.1382$...
    > Hi
    >
    > I am executing a JavaScript Function for a Button and doing some custom

    data
    > validation.
    > Now i want to Ignore the Button Click if the Data validation Fails. i am
    > using return(false) in the JavaScript Function but that does not work.
    >
    > Please help.
    > Thanks
    > RSB
    >
    >
    Ashish M Bhonkiya, May 13, 2004
    #2
    1. Advertising

  3. RSB

    avnrao Guest

    try event.cancelBubble = true;

    Av.
    "RSB" <> wrote in message
    news:MHLoc.1382$...
    > Hi
    >
    > I am executing a JavaScript Function for a Button and doing some custom
    > data
    > validation.
    > Now i want to Ignore the Button Click if the Data validation Fails. i am
    > using return(false) in the JavaScript Function but that does not work.
    >
    > Please help.
    > Thanks
    > RSB
    >
    >
    avnrao, May 13, 2004
    #3
  4. RSB

    RSB Guest

    Hi Avnrao,
    Could you please explain where to put or how to use this code..
    thanks
    RSB
    "avnrao" <> wrote in message
    news:...
    try event.cancelBubble = true;

    Av.
    "RSB" <> wrote in message
    news:MHLoc.1382$...
    > Hi
    >
    > I am executing a JavaScript Function for a Button and doing some custom
    > data
    > validation.
    > Now i want to Ignore the Button Click if the Data validation Fails. i am
    > using return(false) in the JavaScript Function but that does not work.
    >
    > Please help.
    > Thanks
    > RSB
    >
    >
    RSB, May 13, 2004
    #4
  5. RSB

    Ben Dewey Guest

    Make sure that you AutoPostBack Property is set to false on the buttons.


    "RSB" <> wrote in message
    news:MHLoc.1382$...
    > Hi
    >
    > I am executing a JavaScript Function for a Button and doing some custom

    data
    > validation.
    > Now i want to Ignore the Button Click if the Data validation Fails. i am
    > using return(false) in the JavaScript Function but that does not work.
    >
    > Please help.
    > Thanks
    > RSB
    >
    >
    Ben Dewey, May 13, 2004
    #5
  6. RSB

    RSB Guest

    Hi Ben
    i am using a Linkbutton and cannot find the AutoPostBack property for the
    link button..

    thanks RSB

    "Ben Dewey" <> wrote in message
    news:...
    Make sure that you AutoPostBack Property is set to false on the buttons.


    "RSB" <> wrote in message
    news:MHLoc.1382$...
    > Hi
    >
    > I am executing a JavaScript Function for a Button and doing some custom

    data
    > validation.
    > Now i want to Ignore the Button Click if the Data validation Fails. i am
    > using return(false) in the JavaScript Function but that does not work.
    >
    > Please help.
    > Thanks
    > RSB
    >
    >
    RSB, May 13, 2004
    #6
  7. RSB

    avnrao Guest

    set the href to a javascript function like this..
    href="javascript:MyFunction()";

    you can write event.cancelBubble in MyFunction to true and return false;

    Av.
    "RSB" <> wrote in message
    news:MHLoc.1382$...
    > Hi
    >
    > I am executing a JavaScript Function for a Button and doing some custom
    > data
    > validation.
    > Now i want to Ignore the Button Click if the Data validation Fails. i am
    > using return(false) in the JavaScript Function but that does not work.
    >
    > Please help.
    > Thanks
    > RSB
    >
    >
    avnrao, May 14, 2004
    #7
    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. Purvi T
    Replies:
    0
    Views:
    820
    Purvi T
    Oct 19, 2004
  2. Phil Winstanley [Microsoft MVP]

    Re: How to Ignore a Asp:Button or asp:linkbutton click

    Phil Winstanley [Microsoft MVP], May 13, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    441
  3. Sathyaish
    Replies:
    3
    Views:
    3,081
    Sathyaish
    Sep 8, 2005
  4. Amy
    Replies:
    0
    Views:
    954
  5. Rob Meade
    Replies:
    6
    Views:
    254
    Rob Meade
    Mar 1, 2004
Loading...

Share This Page