Solved

how to stop page postback

Posted on 2008-10-13
3
1,333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

617 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