Click here to Skip to main content
15,666,844 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want nodes like this way ,

1) Dashboard
2) Account
2a) Register
2b) Log off
2c) Test1
2d) Test2

so i wrote below code , in Mvc.sitemap
<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns:xsi=""
            xsi:schemaLocation=" MvcSiteMapSchema.xsd">

    <mvcSiteMapNode title="Dashboard" controller="Home" action="Index" description="fa fa-home" />
    <mvcSiteMapNode title="Account" controller="Account" action="Index" roles="admin" description="fa fa-envelope">
      <mvcSiteMapNode title="Register" controller="Account" action="Register" />
      <mvcSiteMapNode title="Log off" controller="Account" action="LogOff" />
      <mvcSiteMapNode title="Test1" controller="Account" action="LogOff" />
      <mvcSiteMapNode title="Test2" controller="Account" action="LogOff" />

and in SiteMapPathHelperModel.cshtml

    @foreach (var node in Model)
        @Html.DisplayFor(m => node)
        var iconClass = node.Description.ToString();

        if (node.Children.Any())

        < i class="@iconClass" aria-hidden="true"></ i> /* this is to show icon */
 @Html.DisplayFor(m => node.Children)


but its not allow write 2 sitemapnodes .
Can any one tell me how to this.
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900