Get cateogories in partial view

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hi All,

I have a partial view called _ProductGrid. THis is located in the views/shared area. Now, when I try and access the catagories, I can't figure it out.

If I add

@model Nop.Web.Models.Catalog.CategoryModel
@if (Model.SubCategories.Count > 0)
{
}

to the top of my partial class then it errors (object ref not set to an instance of an object). How can I  access the cetegoriees from a partial  class?
11 years ago
you have to create a controller or other view first and then pass the category model to the partial view by controller or from the main view. then only you can access it in your partial view.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.