So... I downloaded the "Clean starter kit" and wanted to add a simple Content Picker to the top image. I add the property and get an error saying that the property don't exist.
Looks great, right? So I head over to my VS and I want to extract the property by entering @Model.Link and I get the error:
'PageHeaderViewModel' does not contain a definition for 'Link'
Cool, so I head over to Clean.Core.Models.ViewModels.PageHeaderViewModel and very true, the file is read-only and located in my AppData/local/temp folder.
I have tried everything but I'm completely lost. How in the world do I get my new property to work in my frontend?
I tried using your suggestion but it returns the error:
'PageHeaderViewModel' does not contain a definition for 'Value' and the best extension method overload 'HtmlHelperValueExtensions.Value(IHtmlHelper, string)' requires a receiver of type 'IHtmlHelper'
I have no idea how to update the PageHeaderViewModel.
My file looks like this:
I have not used the starter kit I'm afraid, but you could get it working by changing your View so that is not strongly typed, something like the following
I was also exploring the Clean Starter kit yesterday, i wanted to add an extra Image to a header.
For me the simplest solution was to create my own CustomPageHeaderViewModelclass which inherits from the PageHeaderViewModel. In my custom Viewmodel i declare my new Properties that i need.
Then insted of passing the original Viewmodel to a PartialView i now pass in my Custom Viewmodel. So the Properties are now there.
Im really new to umbraco, so i dont know if there is a better way to do this.
Updating models for Clean Starter Kit
Hey lads,
So... I downloaded the "Clean starter kit" and wanted to add a simple Content Picker to the top image. I add the property and get an error saying that the property don't exist.
Alright, so the model has not updated it looks. So, I head over to https://docs.umbraco.com/umbraco-cms/reference/templating/modelsbuilder/configuration and try it all but I can't access the property.
My property:
Looks great, right? So I head over to my VS and I want to extract the property by entering
@Model.Link
and I get the error:Cool, so I head over to
Clean.Core.Models.ViewModels.PageHeaderViewModel
and very true, the file is read-only and located in myAppData/local/temp
folder.I have tried everything but I'm completely lost. How in the world do I get my new property to work in my frontend?
PS. I use
"ModelsMode": "InMemoryAuto"
Thank you for reading my post.
Hi MB,
try to access the property like this
@Model.Value("propertyname")
if you are using inmemory VS does not know about the properties at design time.Hey Huw and thank you for reaching out!
I tried using your suggestion but it returns the error:
I have no idea how to update the PageHeaderViewModel. My file looks like this:
Hi MB,
I have not used the starter kit I'm afraid, but you could get it working by changing your View so that is not strongly typed, something like the following
I was also exploring the Clean Starter kit yesterday, i wanted to add an extra Image to a header.
For me the simplest solution was to create my own
CustomPageHeaderViewModel
class which inherits from thePageHeaderViewModel
. In my custom Viewmodel i declare my new Properties that i need.Then insted of passing the original Viewmodel to a PartialView i now pass in my Custom Viewmodel. So the Properties are now there.
Im really new to umbraco, so i dont know if there is a better way to do this.
is working on a reply...