GetCustomFieldValue() not working

Posted by Community Admin on 04-Aug-2018 20:23

GetCustomFieldValue() not working

All Replies

Posted by Community Admin on 08-Apr-2015 00:00

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?

This thread is closed