Home > ASP.NET > Tabcontrols and Multiple Gridviews

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"

Categories: ASP.NET
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: