Is it possible to edit Models in Umazel starter kit?
Hi, i like to develop further my umazel site. I like to know if i can add/delete/edit a property in a model class? I need to add a new property but i am not able to do that in c# code in model class.
I can add new properties in document type from umbraco back office but then how can i show them/ implement them on view/.cshtml file?
i did try adding property from umbraco backoffice, it did but i couldnt use that property. New property doesnt exist in c# code. The model classes shows a lock sign 'metadata'
Models are currently created in DLL mode. So if you need to extend your models you may have to create/alter new doctypes/properties and either rebuild your models (from the "Developer" section) or switch to App_Data mode.
I hope I understood correctly - otherwise, please let me know.
I can try to explain with an example. In my umbraco project's Umazel theme, i want to add a new property called 'Price' in a, for example, Document type ContentSliderItem so that i can show this property later in the respective view. I added the property in umbraco back office on the document type. Now back in c# code, i open the .cshtml view where i want my new property should be placed. But the view doesnt read the property because its not present in the viewmodel.
When i try to add in viewmodel class i find i am not able to modify this class, it shows a lock-down icon with class and says [from metadata].
Well, as I mentioned in my previous comment, when you add a new property you will have to rebuild your models - here's a short screencast where I'm adding a property with alias "blah" to the Text Section and show you what I do in Umbraco in order to make it work with Visual Studio: http://screencast-o-matic.com/watch/cDX6j0jPkc
Is it possible to edit Models in Umazel starter kit?
Hi, i like to develop further my umazel site. I like to know if i can add/delete/edit a property in a model class? I need to add a new property but i am not able to do that in c# code in model class. I can add new properties in document type from umbraco back office but then how can i show them/ implement them on view/.cshtml file?
Hi Nitin,
Maybe you have to add new field in Umbraco doctypes before changing models?
Thanks
Alex
i did try adding property from umbraco backoffice, it did but i couldnt use that property. New property doesnt exist in c# code. The model classes shows a lock sign 'metadata'
Hi Nitin,
Models are currently created in DLL mode. So if you need to extend your models you may have to create/alter new doctypes/properties and either rebuild your models (from the "Developer" section) or switch to App_Data mode.
I hope I understood correctly - otherwise, please let me know.
I can try to explain with an example. In my umbraco project's Umazel theme, i want to add a new property called 'Price' in a, for example, Document type ContentSliderItem so that i can show this property later in the respective view. I added the property in umbraco back office on the document type. Now back in c# code, i open the .cshtml view where i want my new property should be placed. But the view doesnt read the property because its not present in the viewmodel.
When i try to add in viewmodel class i find i am not able to modify this class, it shows a lock-down icon with class and says [from metadata].
let me know if i'm unclear
thanks in advance
Well, as I mentioned in my previous comment, when you add a new property you will have to rebuild your models - here's a short screencast where I'm adding a property with alias "blah" to the Text Section and show you what I do in Umbraco in order to make it work with Visual Studio: http://screencast-o-matic.com/watch/cDX6j0jPkc
perfect! Now i am able to add properties. I missed rebuilding using modelbuilder from back office. thanks for the valuable help
is working on a reply...