Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

I am Jalpesh Vadgama a Microsoft MVP for Visual C# and BrainBench Certified ASP.NET Developer having more then 6 years of experience in .NET Technology.
Browse by Tags · View All
#ASP.NET 88
#DOTNET 87
BRH 79
ASP.NET 72
#.NET 52
C#.NET 48
DOTNET 47
ASP.NET 4.0 31
ASP.NET MVC 29
VisualStudio 27

Archive · View All
December 2010 16
July 2011 13
April 2011 13
April 2012 12
January 2011 12
June 2011 11
May 2011 11
May 2012 8
February 2013 7
January 2013 7

Creating dynamic breadcrumb in asp.net mvc with mvcsitemap provider

Apr 9 2012 3:19AM by Jalpesh   

I have done lots breadcrumb kind of things in normal asp.net web forms I was looking for same for asp.net mvc. After searching on internet I have found one great nuget package for mvpsite map provider which can be easily implemented via site map provider. So let’s check how its works. I have create a new MVC 3 web application called breadcrumb and now I am adding a reference of site map provider via nuget package like following.

BreadCumb using site map provider in asp.net mvc

You can find more information about MVC sitemap provider on following URL.

https://github.com/maartenba/MvcSiteMapProvid

So once you add site map provider. You will find a Mvc.SiteMap file like following.

Site map with asp.net mvc

And following is content of that file.

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0"
            xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0 MvcSiteMapSchema.xsd"
            enableLocalization="true">
  <mvcSiteMapNode title="Home" controller="Home" action="Index">
    <mvcSiteMapNode title="About" controller="Home" action="About"/>
      </mvcSiteMapNode>
</mvcSiteMap>

So now we have added site map so now its time to make breadcrumb dynamic. So as we all know that with in the standard asp.net mvc template we have action link by default for Home and About like following.

<div id="menucontainer">
    <ul id="menu">
        <li>@Html.ActionLink("Home", "Index", "Home")</li>
        <li>@Html.ActionLink("About", "About", "Home")</li>
    </ul>
</div>

Now I want to replace that with our sitemap provider and make it dynamic so I have added the following code.

<div id="menucontainer">
       @Html.MvcSiteMap().Menu(true)
</div>

That’s it. This is the magic code @Html.MvcSiteMap will dynamically create breadcrumb for you. Now let’s run this in browser. You can see that it has created breadcrumb dynamically without writing any action link code.

BreadCumb with asp.net mvc

So here you can see with MvcSiteMap provider we don’t have to write any code we just need to add menu syntax and rest it will do automatically. That’s it. Hope you liked it. Stay tuned for more till then happy programming.

Shout it

Tags: #ASP.NET, ASP.NET MVC, BreadCrumb,


Jalpesh
15 · 11% · 3548
2 Readers Liked this
Jacob Sebastian Liked this on 4/10/2012 1:20:00 PM
Profile · Blog · Facebook · Twitter
Guru Samy Liked this on 4/11/2012 12:27:00 AM
Profile · Blog
2
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Creating dynamic breadcrumb in asp.net mvc with mvcsitemap provider" rated 5 out of 5 by 2 readers
Creating dynamic breadcrumb in asp.net mvc with mvcsitemap provider , 5.0 out of 5 based on 2 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]