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

  • Thread starter Thread starter RSB
  • Start date Start date
R

RSB

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
 
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
 
Hi Avnrao,
Could you please explain where to put or how to use this code..
thanks
RSB
try event.cancelBubble = true;

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

thanks RSB

Make sure that you AutoPostBack Property is set to false on the buttons.
 
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.
 
Back
Top