Skip to content

How to get breadcrumbs path in li html mvc anchor tag

Manoj Maharana

Asked Sep 8, 2016, 11:58 PM EDT3 answers
Share
LinkedInX
Here is my example:
    •   
  1.         
  2. "GrandParent.html"
  3. >Grand Parent  
  4.             
        
  5.                 
  6. "Parent.html"
  7. >Parent  
  8.                     
        
  9.                         
  10. "child.html"
  11. >child  
  12.                 
  13.   
  14.               
  15.         
  16.   
  17.       
 

every li element has a anchor tag next to it (not shown in the code, please assume that).

Now if a select value "Child" from the above code then i should get the below result "Grand Parent/ Parent / Child" and if i select parent then i should get "Grand Parent / Parent"

So basically the i want to get parent with all its child

Here is my code:

  1. @helper GetTreeView(Abacus_CMS.Models.AbacusModel siteMenu, int parentID)  
  2.     {  
  3.     var url = new System.Web.Mvc.UrlHelper(Context.Request.RequestContext);  
  4.     foreach (var i in siteMenu.AbacusMenuList.Where(a => a.ParentCatagoryId.Equals(parentID)))  
  5.     {  
  6.             
  7.   
  8.                 @{ var submenu = siteMenu.AbacusMenuList.Where(a => a.ParentCatagoryId.Equals(i.Id)).Count();}  
  9.                 @if (submenu > 0)  
  10.                 {  
  11.   
  12.                 
  13. "margin-left: -6px;"
  14. >  
  15.                     "@url.RouteUrl("GettingStarted", new { catname = HttpUtility.UrlEncode(i.Name.Replace(' ', '-'))})" id="@i.Name.Replace(' ', '-').ToLower()" onclick="GetParents()">  
  16.                         class="fa fa-chevron-right" aria-hidden="true"style="margin-left: 25px; font-size: 10px;">   
  17.                         class="title" style="margin-left: 0px;">@i.Name  
  18.                         class="arrow " style="height: 4px;">  
  19.   
  20.                       
  21.                     
      class
    ="sub-menu">  
  22.                         @treeview.GetTreeView(siteMenu, i.Id)  
  23.                         @* Recursive  Call for Populate Sub items here*@  
  24.                       
  25.                 
  26.   
  27.   
  28.                 @*class="collapse collapsible"> *@  
  29.                 }  
  30.                 else  
  31.                 {  
  32.                     "@url.RouteUrl("GettingStarted", new { catname = HttpUtility.UrlEncode(i.Name.Replace(' ', '-')) })" style="margin-left: 30px;" id="@i.Name.Replace(' ', '-').ToLower()">  
  33.   
  34.                             @i.Name  
  35.                           
  36.                         }  
  37.   
  38.                         
  39.   
  40.   
  41.                 }  
  42.                 }  
how to Get breadcrumb path as text?? 

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Delpin Susai Raj
    0
    http://stackoverflow.com/questions/39408505/breadcrumbs-path-in-li-html-mvc-anchor-tag
    0
  • Delpin Susai Raj
    0
    http://forums.asp.net/p/2103279/6079767.aspx?Re+how+to+get+breadcrumbs+path+in+li+html+mvc+anchor+tag
    0
  • Delpin Susai Raj
    0
    http://www.codeproject.com/Questions/1126758/How-to-get-breadcrumbs-path-in-li-HTML-MVC-anchor
    0