To get intellisense in Visual Studio for your (*.cshtml) files. You need to use the strongly typed Razor. When you using the @CurrentPage you are using the dynamic Razor. So dynamic Razor is conciseness where with strongly typed Razor you will get the intellisense. To get the current page in strongly tyed Razor you need to write. Model.Content.
Forgive me for asking again, but I take it there isn't a documentation similar to what Microsoft does with its documentation -->where it lists methods/properties for each object plus its parent object?
I have not seen such documentation like this myself unfortunately. Perhaps, some other members of the community knows if such of information is available.
Intellisense
I ahve installed UmbracoCMS v7.2 with start kit using VS 2012 (as VS2013 has bug where you can't debug @helper with VS2013).
As I am making way around the code, I am puzzled about something.
What do I need to do to get intellisens in the backoffice and in Visual Studio (*.cshtml) files?
As for me I don't get either?
Thanks
Tom
Hi Tom,
To get intellisense in Visual Studio for your (*.cshtml) files. You need to use the strongly typed Razor. When you using the @CurrentPage you are using the dynamic Razor. So dynamic Razor is conciseness where with strongly typed Razor you will get the intellisense. To get the current page in strongly tyed Razor you need to write. Model.Content.
As you can see here there https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/Content-Picker is two examples on how to get data from the content picker in Umbraco 7. To get the intellisense in Visual Studio you need to use the strongly typed example like this.
Hope this helps,
/Dennis
Dennis:
Thanks for replying.
OK if @CurrentPage is dynamic and I can't get intellisense in my .cshtml page, how do I go about getting a list of what's avaialble?
Thanks
Tom
Hi Tom,
To get a list of what standard Umbraco fields, that´s avaialble, try to see this video Umbraco.TV
http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/templating/setting-up-our-first-template/ You can see the whole video if you want to, but for to answer you question try to see from 3 min 25 sec.
For getting data of of standard field, e.g the when the document is created then use @CurrentPage.createDate.
For your custom properties, use @CurrentPage.propertyAlias. And there is also a list https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7 of the built in properties, with examples on how to get data from it, in both strongly typed Razor or dynamic Razor.
Hope this helps, and don't hesitate to ask again
/Dennis
Dennis:
Forgive me for asking again, but I take it there isn't a documentation similar to what Microsoft does with its documentation -->where it lists methods/properties for each object plus its parent object?
Hi Tom,
I have not seen such documentation like this myself unfortunately. Perhaps, some other members of the community knows if such of information is available.
/Dennis
Hi Tom,
There are some cheat sheets available here that list a lot of the available properties and methods: https://our.umbraco.org/projects/developer-tools/umbraco-v6-mvc-razor-cheatsheets
:)
I totally forgot the Razor cheat sheets : -)
/Dennis
is working on a reply...