That is probably because you are posting back to the server which means the page is being refreshed. If this is the case you are going to have to either
a) Do your postback using AJAX
b) When you regenerate the page you will need to regenerate it with the active tab marked as active.
zachvaldez
ASKER
Thanks!. It would be better if you can show this is code. Looks terrific!
Julian Hansen
The code is highly dependent on your implementation. Are you wanting to go the AJAX route or the post back route.
If post back then all you need to do is when the postback is done check to see what tab is active - not sure how you do this in your code as I don't know what data you are sending back - but I am assuming the context of the data defines the tab - if not you would need to include something in the postback that says what tab is active.
In your server code you have an if condition that checks that value and then sets whatever class is necessary on the tab that is active.
I am giving you broad strokes process here because you will need to adapt this to your code.
I have already explained - you need to do this in code on the server - the HTML code is not helpful because it does not do anything. You need logic on the server that determines what tab you were in (based on parameters sent back as part of the postback) and then renders the page with the correct class assigned to the correct tab.
I can't tell you how to do that based on what you have posted.
What are you using for your tabs (jQuery / Bootstrap)?
Why are you doing a postback to the server from a tab - what is that for - what happens in that step?
You need to provide us with the information we need to help you.
zachvaldez
ASKER
The example I showed you , the button has no code behind and it still jumps to tab1.
a) Do your postback using AJAX
b) When you regenerate the page you will need to regenerate it with the active tab marked as active.