Tabcontrols and Multiple Gridviews

If you have a TabContainer with multiple Tabs, and more than 1 tab have a gridview, any postback actions on the gridview will cause your tabcontainer to jump back to the first tab if you are not did not enclose the TabContainer in an update panel.

Digging into the source code reveals that the ClientStateField property is not updated each time a tab new tab is selected.

To workaround this, include the following javascript into the head of the document

function ActiveTabChanged(sender, e) {
sender.get_clientStateField().value = sender.saveClientState();
}

and inside the TabContainer set the OnClientActiveTabChanged="ActiveTabChanged"

Leave a Reply

Your email address will not be published. Required fields are marked *