Monday, February 25, 2008

ASP.NET Tabs

This demo will show you how to use the ASP.NET AJAX Control Toolkit Tab Container and Tab Panel controls. You can use these controls on a web page to display a tabbed interface.







One thing to note is that if you are currently on the second tab and trigger an event that does a post back, then your page will reload and not display the same tab you we're on. The work around I did using the UpdatePanel is an easy fix for this.



If you need your page to load with a certain tab selected, use the ActiveTabIndex property. (ex: TabContainer1.ActiveTabIndex = 2 will select the third tab). Usually if I want to do this conditionally I will link to a page with the tab index in the query string and then check for that value in the page_load event. If there is a value then make that tab active!

1 comment:

Mirabel said...

Interesting to know.