I have a button that I want to function like normal, except I don’t want it to postback.
If a user clicks it, I want to execute the Button Click event on the next postback, I just don’t want that particular button to be able to postback.
I tried this:
<asp:Button ID="ChangeAllBtn" runat="server" Text="Change All" OnClientClick="return false;" OnClick="ChangeAllBtnClick" />
But it doesn’t call the ChangeAllBtnClick after I postback.
If I remove the “return false;”, then there is postback before I want it.
What do?
Seems like an odd request. I’m not sure how to do it off the top of my head. Would it be possible to structure your code in such a way that when you post back it just executes the code that would have been in your button click event? Example:
If that’s not an option I would probably create a hidden field that is a server side control. Then you can set this from the client side script and check the value on the server side.