Solved

how to stop page postback

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

839 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