Getting this error with my partial view:
@inherits Umbraco.Web.Mvc.UmbracoViewPage @using umbraco.MacroEngines@helper setHeadings(string sectionHeading,string pageHeading,string contentTitle){ }
@functions{
public string getSectionIcon(dynamic node){
string prefix = “”;
dynamic rootNode = Model.AncestorOrSelf();
if(rootNode.HasValue(“mainMenu”)){
foreach(var item in rootNode.mainMenu){
var id = item.link.ToString();
if(id == node.Id.ToString()){
prefix = item.prefix.ToString() + " ";
}
}
}
return prefix;
}
}@helper eventHeadings(){
@setHeadings(“Event Section”,“Event Heading”,“Event Title”)
}@helper newsHeadings(){
@setHeadings(“News Section”,“News Heading”,“News Title”)
}@helper primaryCareHeadings(){
@setHeadings(“Primary Care”,“PC Heading”,“PC Title”)
}@helper defaultHeadings(){
int level = Model.Level;
string sectionHeading = “”;
string pageHeading = “”;
string contentTitle = “”;
string parentLink;
dynamic parent;if(Model.Level <= 2){ //Level 1 sectionHeading = getSectionIcon(Model) + Model.Title; } else { //Level 2+ dynamic sectionNode = Model.AncestorOrSelf(2); sectionHeading = getSectionIcon(sectionNode) + " " + sectionNode.Title; //sectionHeading = sectionNode.Title; } //Just show title for pages at level 2 if(level < 4) { //Level 1-3 pageHeading = Model.HasValue("subheading") ? Model.Subheading : Model.Title; } else { //Level 4+ parent = Model.Parent; //Show link to parent and then page title... pageHeading = parent.Title; contentTitle = Model.Title; } @setHeadings(sectionHeading,pageHeading,contentTitle)
}
@{
string nodeType = Model.NodeTypeAlias;switch (nodeType) { case "event": @eventHeadings() break; case "news": @newsHeadings() break; case "primaryCare": @primaryCareHeadings() break; default: @defaultHeadings() break; }
}
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/40977-umbracowebmodelsrendermodel-does-not-contain-a-definition-for-nodetypealias