Close

Subcategories of subcategory not in CategoryMenuTemplate.Responsive.cshtml

clubfredd
10 years ago
#5748 Quote
Avatar
  • 18
Hi there,

On CategoryMenuTemplate.WithPictures.cshtml, the code shows the Category > Subcategory > Sub-subcategory (basically, grandchildren):


@if (Model.CategoriesModels.Count > 0)
{
   ...
   foreach (var category in Model.CategoriesModels)
   {
   ...
      @if (category.SubCategories.Count > 0)
      {
      ...

@foreach (var subCategory1 in item.SubCategories.Take(megaMenuSettings.NumberOfCategories))
                            {
                                <li><a href="@Url.RouteUrl("Category", new { SeName = subCategory1.CategoryModel.SeName })" title="@subCategory1.CategoryModel.Name">
                                    @subCategory1.CategoryModel.Name</a>
                                </li>
                            }
      ...
      }

   ...
   }

...
}


On CategoryMenuTemplate.Responsive.cshtml, it only shows Category > Subcategories only. How can I insert the code above into CategoryMenuTemplate.Responsive.cshtml to show grandchildren?

Thank you!
clubfredd
10 years ago
#5763 Quote
Avatar
  • 18
Figured it out.
Based it on Boyko's solution from way back using foreach instead of the DataTable helper method.