Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm trying to get a boolean value from both the current page field and a macro parameter (which is on the same page). Using this code I was able to do it:
bool adsOn = Model.MacroParameters["adsEnabled"].ToString() != "0"; bool globalAdsOn = Model.Content.GetProperty("adsEnabled").Value().ToString().ToLower() != "false";
But this feels unnecessarily verbose. Is there a better way to do this?
Thanks!
Edit: I also noticed if the macro parameter has never been set to true or false, the value returned is true even the UI shows the toggle set to false.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Best way to get boolean from page fields and macro parameters
Hi,
I'm trying to get a boolean value from both the current page field and a macro parameter (which is on the same page). Using this code I was able to do it:
But this feels unnecessarily verbose. Is there a better way to do this?
Thanks!
Edit: I also noticed if the macro parameter has never been set to true or false, the value returned is true even the UI shows the toggle set to false.
is working on a reply...