Tabstrip in ASP.NET MVC Application

Tabstrip
There are various navigation components that are used in ASP.NET MVC Applications among them Tabstrip is one of the most useful navigation component that is used. In case of Tabstrip component user can control the look of his/her tab by using various configurations like we can  insert images , links etc

Untitled-1n.gif

Controller

using System.Web.Mvc;
using MvcApplication7.Models;
namespace MvcApplication7.Controllers
{
public
partial class TabStripController : Controller
{
[PopulateSiteMap(SiteMapName = "sample", ViewDataKey = "sample")]
[SourceCodeFile("Sitemap", "~/sample.sitemap")]
public
ActionResult SiteMapBinding()
{
if
(!SiteMapManager.SiteMaps.ContainsKey("sample"))
{
SiteMapManager.SiteMaps.Register<XmlSiteMap>("sample", sitmap =>
sitmap.LoadFrom("~/sample.sitemap"));
}
return
View();
}
}
}

View

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content contentPlaceHolderID=
"MainContent" runat="server">
<% Html.mvc().TabStrip()
.Name(
"TabStrip")
/* ViewData["sample"] contains the sitemap */
.BindTo("sample", (item, node) => {
if (string.IsNullOrEmpty(node.ActionName) && node.ChildNodes.Count > 0)
{
if(!string.IsNullOrEmpty(node.ChildNodes[0].ControllerName))
item.ControllerName = node.ChildNodes[0].ControllerName;
if(!string.IsNullOrEmpty(node.ChildNodes[0].ActionName))
item.ActionName =node.ChildNodes[0].ActionName;
}
})
.Render();
%>
</asp:Content>

 

Ebook Download
View all
Learn
View all