GetCustomFieldValue() not working
I'm trying to access some custom field values utilizing some of the code outlined here:
docs.sitefinity.com/for-developers-access-custom-fields-through-the-sitemapnodes
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?