As Alex rightly pointed out, you should try to inherit from your appropriate document type (Tema) in order to access the relevant properties - keeping in mind that the alias will begin with an uppercase letter.
Therefore, the following code snippet should work:
Hi Bo
I'm new to MVC and i dont understand the model.
When I create documenttypes and associate them do a template is that a model? So for example if i have a documenttype title,ingress associated to home template is model = home
Modelsbuilder error with PureLive
Hi i need some help I trying to use modelsbuilder and i'm following Umbraco.tv part working with pureLive
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
When i'm using @Model.Content.GetPropertyValue("ingress") it's working but when i'm using @Model.Content.ingress i get an error
CS1061: Umbraco.Web.PublishedContentModels doesn't contain a definition for ingress . /C
Hi Christina
Try to use this code:
Where doctypeClass is a class name of current doctype.
Also, all properties should start with a capitalized first letter:
Thanks,
Alex
Thanks I tried but i got another error
CS0246: Could not find the type or name area name Doctype Class (missing a user directive or a compilation reference?)
I have tried to capitalize but the editor converts the first to lowercase with the padlock icon
I have created the documenttype and associated it with the template Tema is it right? /C
Yes, is Tema your doctype? Then the first line of code should be:
Thanks for helping me out
if i use that @inherits UmbracoTemplatePage
I got the same error as in the first place/C
if you use that @inherits UmbracoTemplatePage
then you have to use this code for getting value of current page:
Yes that works/C
Thanks for helping me I'm using
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using ContentModels = Umbraco.Web.PublishedContentModels;
I want to use @Model.Content.Ingress
I can't figure out whats wrong
/C
Then add
Thanks Alex
@inherits UmbracoTemplatePage
@using ContentModels = Umbraco.Web.PublishedContentModels;
Works @Model.Content.GetPropertyValue("subHeader")
Doesn't work @Model.Content.subHeader
Do you have any idea, whats wrong, I'm using Umbraco version 7.10.3 assembly: 1.0.6676.26622
/C
Hi Christina,
As Alex rightly pointed out, you should try to inherit from your appropriate document type (
Tema
) in order to access the relevant properties - keeping in mind that the alias will begin with an uppercase letter.Therefore, the following code snippet should work:
Thanks for helping i have done that but it doesn't work I got error CS1061: /C
Are you sure that you are working with "pureLive" mode?
Thanks for helping med The editor is not showing all of my code
webconfig:
.NET
/C
Big Thanks now it works /C
You are welcome, happy to help.
Alex
Hi again How Can i use ModeelsBuilder in a PartialView I have tried
@Model.Content.SubHeader
I got this Error Message: CS0122 Thanks for helping me out :) /C
Hi Christina.
How do you call your PartialView? Do you remeber to pass the model to it?
Hi Bo I'm new to MVC and i dont understand the model. When I create documenttypes and associate them do a template is that a model? So for example if i have a documenttype title,ingress associated to home template is model = home
Thanks /C
is working on a reply...