Get category list as html in plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 年 前
Hi

I´m building a plugin and need to get the category list in html but I can´t manage to get the category list. Anyone who can help me in the right direction.
12 年 前
var categories = _categoryService.GetAllCategories(true);


(boolean param indicating whether to show hidden records)
12 年 前
New York wrote:
var categories = _categoryService.GetAllCategories(true);


(boolean param indicating whether to show hidden records)



yes, i think based on the question he needs more info....

- do what "New York" sayd in your Conroller / Service Method.
- you have to do "constructor-inject" the ICategoryService .... in your Plugin/Controller/Service wherever you make this.
- return a View ( cshtml ) that takes a List<Categorie> as model or a single model an call it for every Category ... the sky is the limit ..


greetings
12 年 前
Thanks for your answers

But I´m struggling to get the list of categories into my view.cshtml I have the list in my controller but can´t get it into a model to be used in the view.

I need the list in a model in my view :   @Html.Raw(Model.Categories)
12 年 前
TCH wrote:
I need the list in a model in my view :   @Html.Raw(Model.Categories)


first line of your view sould contain something like:

@model NameSPaceToMode.Model   - > to tell the view which model it should know ...


show us what you got, so we can be more effective ...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.