Learn how to a build a cloud-first strategyRegister Now


remove the postback of an ASP button is clicked?

Posted on 2011-05-02
Medium Priority
Last Modified: 2013-12-16
Hi to remove the postback of an ASP button is clicked?
Question by:PagodNaUtak
LVL 13

Accepted Solution

Rick earned 800 total points
ID: 35505438

Try this on your page_load event:

button1.Attributes.Add("OnClick", "return false;")
LVL 23

Assisted Solution

by:Rajkumar Gs
Rajkumar Gs earned 400 total points
ID: 35505534
Same question - Why you are trying to do so ?

If you want to use the button click only once, you can try rick's suggestion.

Another solution, that I have is disable the button on click
btnButton.Enabled = False
which I think would be decent - Otherwise end-user will think something wrong with the site and keeps on clicking on the button.


Author Comment

ID: 35505820
Well,  I have two listbox, between the listbox there are two buttons move left and move right. When I click on the button, I do not want the entire page to reloaded. I just want the items to be updated according to the selection and button press.

I have I explain what I need to do. Any help is greatly appreciated.

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Assisted Solution

ingriT earned 400 total points
ID: 35506068
Put the listboxes in an asp:UpdatePanel. Only this part will then reload.

If you're new to UpdatePanels, you probably need to look around the web a bit for samples;
LVL 83

Assisted Solution

CodeCruiser earned 400 total points
ID: 35508284
I think you want to set OnClientClick

button1.Attributes.Add("OnClientClick", "return false;")
LVL 13

Assisted Solution

Rick earned 800 total points
ID: 35513298
Then you need to use an update panel, like ingriT mentioned.
See this link.

Featured Post

Technology Partners: 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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Integration Management Part 2
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

864 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