What is the difference between UmbracoViewPage and UmbracoTemplatePage
As the title says...
My guess would be that UmbracoTemplatePage is for partial views since there are less properties exposed but I don't really know what the underlying ideology is.
UmbracoTemplatePage is mostly a convenience, it is the same as UmbracoViewPage<RenderModel> except it also has the CurrentPage dynamic property which is the dynamic model of Model.Content
All of them have the same Umbraco helper, etc. so Umbraco.Field(...) will work with both.
UmbracoTemplatePage model is a RenderModel (having a Content property which is of type IPublishedContent) or a RenderModel<TContent> (having a Content property which is of type TContent). So Model.Content is a strongly-typed content. In addition, UmbracoTemplatePage adds a CurrentPage property which is a dynamic.
UmbracoViewPage is clever: depending on whether your view inherit from UmbracoViewPage<IPublishedContent> or UmbracoViewPage<RenderModel>> the model will be directly the IPublishedContent, or a RenderModel instance.
Now which one should one use?
In my mind, if you don't plan on using the dynamic CurrentPage property then using UmbracoViewPage makes sense, and then Model is your current content. OTOH if you want the dynamic CurrentPage property, you'll want UmbracoTemplatePage. And the generic versions are for future usage, when we'll be able to use UmbracoViewPage<NewsItem> where NewsItem would be a strongly-typed implementation of IPublishedContent corresponding to content type "news item" -- but that is not working at the moment in 7.1.
What is the difference between UmbracoViewPage and UmbracoTemplatePage
As the title says...
My guess would be that UmbracoTemplatePage is for partial views since there are less properties exposed but I don't really know what the underlying ideology is.
Hi James,
UmbracoTemplatePage
is mostly a convenience, it is the same asUmbracoViewPage<RenderModel>
except it also has theCurrentPage
dynamic property which is the dynamic model ofModel.Content
Jeavon
Trying to summarize the differences:
UmbracoViewPage<TModel> : WebViewPage<TModel>
UmbracoViewPage : UmbracoViewPage<IPublishedContent>
UmbracoTemplatePage : UmbracoViewPage<RenderModel>
UmbracoTemplatePage<TContent> : UmbracoViewPage<RenderModel<TContent>>
All of them have the same Umbraco helper, etc. so Umbraco.Field(...) will work with both.
UmbracoTemplatePage model is a RenderModel (having a Content property which is of type IPublishedContent) or a RenderModel<TContent> (having a Content property which is of type TContent). So Model.Content is a strongly-typed content. In addition, UmbracoTemplatePage adds a CurrentPage property which is a dynamic.
UmbracoViewPage is clever: depending on whether your view inherit from UmbracoViewPage<IPublishedContent> or UmbracoViewPage<RenderModel>> the model will be directly the IPublishedContent, or a RenderModel instance.
Now which one should one use?
In my mind, if you don't plan on using the dynamic CurrentPage property then using UmbracoViewPage makes sense, and then Model is your current content. OTOH if you want the dynamic CurrentPage property, you'll want UmbracoTemplatePage. And the generic versions are for future usage, when we'll be able to use UmbracoViewPage<NewsItem> where NewsItem would be a strongly-typed implementation of IPublishedContent corresponding to content type "news item" -- but that is not working at the moment in 7.1.
Making sense?
Thanks for that guys. Much clearer now.
below link will be helpful
http://24days.in/umbraco/2015/strongly-typed-vs-dynamic-content-access/
is working on a reply...