#How does a content type know which view it is assigned to?
1 messages · Page 1 of 1 (latest)
The view used is the Template assigned to the document type, if you have more than one template for the document type then you can select which one to use on the "info" section for the node
so in my case I will have a single view "youtube.cshtml" with the html markup, I then need to inject the url and size from the document type / property editors - Fortunately I have a working version of the site but I couldnt figure out where the "link" takes place to say "this data will be injected into this view / template"
at the top of your view you should see something like
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.YOURMODELNAME>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
This gives you access to your nodes data, you can then use Model.MyProperty to get the values to assign for link/size etc
Hmm this is the one I ahve from the previously working view: @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@{
var nodeId = int.Parse(ViewData["id"].ToString());
var node = Umbraco.Content(nodeId);
}
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@{
var nodeId = int.Parse(ViewData["id"].ToString());
var node = Umbraco.Content(nodeId);
}