Adding a Categorylist to all pages with MVC4

Posted by Sidriel on Stack Overflow See other posts from Stack Overflow or by Sidriel
Published on 2012-11-21T10:23:34Z Indexed on 2012/11/21 11:02 UTC
Read the original article Hit count: 182

Filed under:
|
|
|
|

I'm new with MVC4 and just MVC.

I have a homecontroller and a categorycontroller. The categorycontroller sends data from the model to the categoryIndex view. That's works fine.

But now I want to add the categorylist on all the available controllers.

I already fixed this to add in all classes return view(db.categorys.ToList()); and add categoryIndex to the shared folder. In _layout.cshtml I'm adding a@RenderPage("~/")` and this works.

But when I have to pass more than only the (db.categorys.ToList()) in the return it goes wrong.

How can I fixed this problem. How do I add the categorylist too every controller and page properly?

© Stack Overflow or respective owner

Related posts about mvc

Related posts about view