Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > User Account - Custom Field View modes: 
User avatar
Member
Member
tspring-allegra - 6/28/2010 4:50:52 AM
   
User Account - Custom Field
Hi

Is it possible to read a custom field from a User account using the CMSContext.CurrentUser function?

If I simply try adding the custom field name onto the end of the function (CMSContext.CurrentUser.myField) I get an error: "'CMS.CMSHelper.CurrentUserInfo' does not contain a definition for 'myField'"

Thanks,
Tim

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 6/28/2010 8:32:45 AM
   
RE:User Account - Custom Field
Hi,

You can use following code to get custom data from CurrentUser object:

CMS.CMSHelper.CMSContext.CurrentUser.GetValue("FiledName");

I hope this will help you.

Best regards,
Miroslav Remias.


User avatar
Member
Member
tspring-allegra - 6/28/2010 9:12:26 AM
   
RE:User Account - Custom Field
Worked great, thanks!