Here is my example:
-
- "GrandParent.html"
>Grand Parent -
-
- "Parent.html"
>Parent -
-
- "child.html"
>child
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:
- @helper GetTreeView(Abacus_CMS.Models.AbacusModel siteMenu, int parentID)
- {
- var url = new System.Web.Mvc.UrlHelper(Context.Request.RequestContext);
- foreach (var i in siteMenu.AbacusMenuList.Where(a => a.ParentCatagoryId.Equals(parentID)))
- {
-
- @{ var submenu = siteMenu.AbacusMenuList.Where(a => a.ParentCatagoryId.Equals(i.Id)).Count();}
- @if (submenu > 0)
- {
-
- "margin-left: -6px;"
> - "@url.RouteUrl("GettingStarted", new { catname = HttpUtility.UrlEncode(i.Name.Replace(' ', '-'))})" id="@i.Name.Replace(' ', '-').ToLower()" onclick="GetParents()">
- class="fa fa-chevron-right" aria-hidden="true"style="margin-left: 25px; font-size: 10px;">
- class="title" style="margin-left: 0px;">@i.Name
- class="arrow " style="height: 4px;">
-
- class
- @treeview.GetTreeView(siteMenu, i.Id)
- @* Recursive Call for Populate Sub items here*@
- @*class="collapse collapsible"> *@
- }
- else
- {
- "@url.RouteUrl("GettingStarted", new { catname = HttpUtility.UrlEncode(i.Name.Replace(' ', '-')) })" style="margin-left: 30px;" id="@i.Name.Replace(' ', '-').ToLower()">
- @i.Name
- }
- }
- }
Delpin Susai RajPosted Sep 13, 2016, 4:01 AM
Delpin Susai RajPosted Sep 13, 2016, 4:01 AM
Delpin Susai RajPosted Sep 13, 2016, 4:00 AM