Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Guttorm Haaversen 2 posts 22 karma points
    Jul 10, 2018 @ 13:54
    Guttorm Haaversen
    0

    I am unable to access custom properties from codein c#

    I am unable to access custom properties from codein c# On a web page of a given document type I have (old) properties where everything works fine, Ie I get the value from code. But when I added two new properties today on the very same web page, I am unable to access the new values from code.

    This (old) on works: string cid = Umbraco.Field("customerID", recursive: true).ToString(); =>Return the value: 2 Neither of these work (the first is true/false, set to true, the second is string set to "true": string a = Umbraco.Field("showaddresssearchforadmonlystring", recursive: true).ToString(); =>Return: empty string bool a = Convert.ToBoolean(Umbraco.Field(" showaddresssearchforadmonly", recursive: true)); =>Return: Unable to cast object of type 'System.Web.HtmlString' to type 'System.IConvertible'. Both

    =>And yes before you ask: I have checked case and yes all three values are custom properties on the very same web page two levels above the active web page.

    Any clues would be appreciated.

Please Sign in or register to post replies

Write your reply to:

Draft