I want to pass models to my PartialView and for this goal i must inherit my partial view from:
@inherits Umbraco.Web.Mvc.UmbracoViewPage
but i donot know where must i add this model. how can i create this model? is there any tool in backoffice or is there any spatial folder for inserting my models inside it?
I wrote an article once about the difference in stronly typed and dynamic content access in Umbraco. It also explains the difference between the different template base types.
I create some data type by using archetype package in my solution. now i want create my model base on this datatypes and use them as model type in my partial view. is there any solution in modelsBuilder to build this models from datatype???
how to add my strongly type models to my project?
I want to pass models to my PartialView and for this goal i must inherit my partial view from:
but i donot know where must i add this model. how can i create this model? is there any tool in backoffice or is there any spatial folder for inserting my models inside it?
Hi Navid
First of all you have to add another inherits:
Where YourModelClassName - is your document type class name.
Umbraco Models builder creates class for each document type. Read docs here: https://github.com/zpqrtbnk/Zbu.ModelsBuilder/wiki/Umbraco.ModelsBuilder
What version of Umbraco are you using?
Thanks,
Alex
I am using umbraco v 7.5.13. about generic inheritance you are right. i forget to add this part of code
Hi Navid,
I wrote an article once about the difference in stronly typed and dynamic content access in Umbraco. It also explains the difference between the different template base types.
http://24days.in/umbraco-cms/2015/strongly-typed-vs-dynamic-content-access/
And if you are interested in generating strongly typed models from your doctypes this article I wrote is also interesting. It explains the different modes you can use the Umbraco Modelsbuilder in : http://24days.in/umbraco-cms/2016/getting-started-with-modelsbuilder/
Dave
I create some data type by using archetype package in my solution. now i want create my model base on this datatypes and use them as model type in my partial view. is there any solution in modelsBuilder to build this models from datatype???
Hi Navid,
I haven't used Archetype lately. But it's well documented : https://github.com/kgiszewski/ArchetypeManual
Maybe this can help you figure out how to work with strongly typed models in combination with archetype.
Dave
is working on a reply...