remove the postback of an ASP button is clicked?

Hi to remove the postback of an ASP button is clicked?
LVL 8
PagodNaUtakAsked:
Who is Participating?
 
RickCommented:
Why?!?


Try this on your page_load event:

button1.Attributes.Add("OnClick", "return false;")
0
 
Rajkumar GsSoftware EngineerCommented:
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.

Raj
0
 
PagodNaUtakAuthor Commented:
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.

:)
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
ingriTCommented:
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;
http://msdn.microsoft.com/en-us/library/bb386452.aspx
0
 
CodeCruiserCommented:
I think you want to set OnClientClick

button1.Attributes.Add("OnClientClick", "return false;")
0
 
RickCommented:
Then you need to use an update panel, like ingriT mentioned.
See this link.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.