Try Now
More in this section

Forums / Bugs & Issues / GetCustomFieldValue() not working

GetCustomFieldValue() not working

1 posts, 0 answered
  1. Ed
    Ed avatar
    20 posts
    26 Mar 2013
    08 Apr 2015
    Link to this post

    I'm trying to access some custom field values utilizing some of the code outlined here:


    I do something like this where page.Id.ToString() is definitely returning a guid:

    var provider = SiteMapBase.GetCurrentProvider() as SiteMapBase;
    var node = provider.FindSiteMapNodeFromKey(page.Id.ToString()) as PageSiteNode;

    Later in the code, I try to retrieve a custom field value by doing something like this:

    va areaOfStudy = node.GetCustomFieldValue("areaOfStudy")

    It fails because, as it turns out, node is not an object. I get this error telling me so:

    System.NullReferenceException: Object reference not set to an instance of an object.

    Any ideas?

1 posts, 0 answered