If you can live with a javascript solution, see how this supports jQuery UI Accordion . Essentially, you can select a dedicated tab based on the controller by examining the request URL when the page loads.
Alternatively, you can set the ViewBag element for each tab to match the value of the tab class. Set the current tab to the value of the active css class, and the rest to empty (or by default). Then you can use:
<li id="HomeTab" class="<%= ViewBag.HomeTabClass %>" /> <li id="OtherTab" class="<%= (string)ViewBag.OtherTabClass %>" />
In your controller, you must set the correct values ββfor the ViewData variables.
ViewBag.HomeTabClass = "tab activeTab"; ViewBag.OtherTabClass = "tab";
tvanfosson
source share