Solved

how to stop page postback

Posted on 2008-10-13
3
1,328 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

773 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