code_junkie

asp.net mvc and css: Having menu tab stay highlighted on selection

Nov 13th, 2011
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <li class="<%=Html.IsSelected(string a, string b)%>" >
  2.  
  3. <li id="HomeTab" class="<%= (string)ViewData["homeTabClass"] %>" />
  4. <li id="OtherTab" class="<%= (string)ViewData["otherTabClass"] %>" />
  5.  
  6. ViewData["homeTabClass"] = "tab activeTab";
  7. ViewData["otherTabClass"] = "tab";
  8.  
  9. ViewData["Home"] = "activeTab";
  10.  
  11. return View("Index");
  12. }
  13.  
  14. <li class="<%= ((string)ViewData["Home"] ?? "") %>"><%= Html.ActionLink("Home", "Index", "Home")%></li>
  15. <li class="<%= ((string)ViewData["About"] ?? "") %>"><%= Html.ActionLink("About", "About", "Home")%></li>
Add Comment
Please, Sign In to add comment