Solved

how to stop page postback

Posted on 2008-10-13
3
1,326 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:Odessa_Technologies
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 250 total points
ID: 22701028
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
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22701032
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
 
LVL 43

Expert Comment

by:TimCottee
ID: 22701255
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now