Return to doc.sitecore.com

Valid for Sitecore 5.3.1
2.  Checkbox
Prev Next

The simple field type, Checkbox stores it raw value as text:

  1

It's possible to resolve the value by using implicit casting

public static string outCheckbox(Sitecore.Data.Items.Item item, string sFieldName)
{
  System.Text.StringBuilder builder
= new System.Text.StringBuilder();
  Sitecore.Data.Fields.CheckboxField checkboxField
= item.Fields[sFieldName];
  builder.Append(checkboxField.Checked.ToString());
  
return builder.ToString();
}

Result:

True

 


Prev Next