Hey, so i appreciate that this has been asked before...but I'm still stuck.
So I'm using Umbraco v7.2.6 ad I'm trying to create a macro which has a true/false parameter which I need to render as a either true or false string on the page. I appreciate that the true/false data type returns 0 or 1 an that you therefore need to convert...but I'm having no luck.
The code in my cshtml is:
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var footer = "";
var hideFooter = @Model.MacroParameters["data-gist-hide-footer"];
if (hideFooter.Equals("0")) {
footer = "true";
} else {
footer = "false"
}
}
<div>@footer</div>
Macro Parameters
Hey, so i appreciate that this has been asked before...but I'm still stuck.
So I'm using Umbraco v7.2.6 ad I'm trying to create a macro which has a true/false parameter which I need to render as a either true or false string on the page. I appreciate that the true/false data type returns 0 or 1 an that you therefore need to convert...but I'm having no luck.
The code in my cshtml is:
But when I run the page i get:
Any advice for an umbraco novice would be great...cheers! :)
In umbracoSettings.Config update the bit
to
Then hit page again you should get full error this will help to debug.
Regards
Ismail
Dashes might be invalid characters in macro paramater aliases (don't remember for sure). Worth a try to rename the parameter and try again.
Hey Ismail & Sebastiaan,
Thanks for your pointers, I got the debugger to display more info and renamed my parameters and managed to get the macro working:
Every day's a school day! :) Cheers Hugh
is working on a reply...