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

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
 
A

Ashish M Bhonkiya

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
 
R

RSB

Hi Avnrao,
Could you please explain where to put or how to use this code..
thanks
RSB
try event.cancelBubble = true;

Av.
 
R

RSB

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.
 
A

avnrao

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top