I am having an issue with my Multinode tree picker Macro. I have the MTP in a property that is in my Global doctype. Some pages/nodes are using the MTP to put certain content on pages I need them for.
My issue is, on the pages that I have picked something in the MTP, they work fine. But for pages that I have not chosen anything, I am getting "Error loading MacroEngine script (file: SurveyModule.cshtml)"
I have nod idea why, I have tried a few things. I did a simple test to see if the my picker was Empty and print out some text and that seemed to work.
BUT when I try to find my node properties, it gives me the MacroEngine error on the pages that done have anything selected in the MTP. It almost seems to be when I add my var it errors. But I don't know for sure. Can someone please help me out?
My code is below.
@{ var nodeItem = @Model.surveyModulePicker; var surveyNode = @Model.NodeById(nodeItem.InnerText);
@*TODO: Put logic in to test if the current page has anything in the surveyModulePicker and now show it on those pages. Currently shows on all pages.*@ if(@Model.GetProperty("surveyModulePicker") != string.Empty){ if(@surveyNode.HasValue("surveyModuleURL")){ <div class="surveyHintModule"> <span class="surveyModuleCloseBtn">Close X</span> <p>Help the Museum design new, useful content for our website by taking this short survey. You could <strong>win four Museum tickets</strong> just for participating! </p> <a href="@surveyNode.surveyModuleURL" target="_blank" class="surveyModuleLink">Click Here</a> </div> } } else{ }
Multinode Tree Picker Razor Macro Error
I am having an issue with my Multinode tree picker Macro. I have the MTP in a property that is in my Global doctype. Some pages/nodes are using the MTP to put certain content on pages I need them for.
My issue is, on the pages that I have picked something in the MTP, they work fine. But for pages that I have not chosen anything, I am getting "Error loading MacroEngine script (file: SurveyModule.cshtml)"
I have nod idea why, I have tried a few things. I did a simple test to see if the my picker was Empty and print out some text and that seemed to work.
BUT when I try to find my node properties, it gives me the MacroEngine error on the pages that done have anything selected in the MTP. It almost seems to be when I add my var it errors. But I don't know for sure. Can someone please help me out?
My code is below.
@{
var nodeItem = @Model.surveyModulePicker;
var surveyNode = @Model.NodeById(nodeItem.InnerText);
@*TODO: Put logic in to test if the current page has anything in the surveyModulePicker and now show it on those pages. Currently shows on all pages.*@
if(@Model.GetProperty("surveyModulePicker") != string.Empty){
if(@surveyNode.HasValue("surveyModuleURL")){
<div class="surveyHintModule">
<span class="surveyModuleCloseBtn">Close X</span>
<p>Help the Museum design new, useful content for our website by taking this short survey. You could <strong>win four Museum tickets</strong> just for participating!
</p>
<a href="@surveyNode.surveyModuleURL" target="_blank" class="surveyModuleLink">Click Here</a>
</div>
}
}
else{
}
Try this and see:
var nodeItem = @Model.surveyModulePicker.XPath("//nodeId[1]").InnerText;
var node = @Model.NodeById(@nodeItem);
@node.Name
Best of luck!
/Raylin
is working on a reply...