how to stop page postback

i'm adding an attribute button click and calling a JavaScript function. but each time i click on the button script is working but page is posting back.
I know to stop post back we use JavaScript.
LVL 2
Odessa_TechnologiesAsked:
Who is Participating?
 
TimCotteeConnect With a Mentor Head of Software ServicesCommented:
Hello Odessa_Technologies,

Make sure that you also add "return false;" to the script e.g.,

MyButton.Attributes.Add("Onclick","doMyFunction();return false;")

Regards,

TimCottee
0
 
Gyanendra SinghArchitectCommented:
make some small changes in your javascript function ...

add return false in that function ...

and in your attribute button click event add  return before your javascript function .
Javascript : return your functionnamer();  like this
0
 
TimCotteeHead of Software ServicesCommented:
Odessa_Technologies,

Why a 'B' grade, whilst I don't have an issue with receiving other than an 'A' when it is warranted I don't understand why this didn't qualify.

TimCottee
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.