Reading values from an Sitecore Item
string fieldValue;
//Option
1: Getting the fieldvalue
directly
fieldValue
= Sitecore.Context.Item["MyField"];
//Option
2: Getting the field and then reading the value
Sitecore.Data.Fields.Field myField
= Sitecore.Context.Item.Fields["MyField"];
if (myField
!= null)
fieldValue
= myField.Value;
No comments:
Post a Comment