Checklist Properties

Checklist Properties

Checklist Fields

  • Store selected field values as a pipe-separated list of GUIDs
  • There is no web control for declarative markup
  • Not supported by FieldRenderer.Render() method or FieldRenderer control
  • Supported by Sitecore.Data.Fields.MultilistField class in Sitecore API
  • Use GetItems() method to retrieve an item array
  • Support use of Sitecore Query to filter on source property
  • Do not natively support displaying field values in the Page Editor

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Factory
  • Sitecore.Data.Database
  • Sitecore.Data.Fields.MultilistField
  • Sitecore.Data.Items.Item
  • Sitecore.MainUtil

Checklist Properties C# Web Control Code

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("C# Web Control Real-time Output");
output.RenderEndTag();

//get List Fields metadata item from context database using item guid
Sitecore.Data.Database db = Sitecore.Context.Database;
Sitecore.Data.Items.Item item = db.GetItem("{7246223A-BFB0-41F9-8A91-1E7D931CDC43}");
if (item == null) return;
Sitecore.Data.Fields.MultilistField clFld = item.Fields["example checklist"];
if (clFld == null) return;

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//using : for colon and   for space
output.Write("{0}: {1}", "Field", clFld.InnerField.DisplayName);
output.RenderEndTag(); //P

output.Write("Can Read? " + "<b>" + clFld.InnerField.CanRead.ToString() + "</b><br/>"); 
output.Write("Can Write? " + "<b>" + clFld.InnerField.CanWrite.ToString() + "</b><br/>"); 
output.Write("Contains Standard Value? " + "<b>" + clFld.InnerField.ContainsStandardValue.ToString() + "</b><br/>"); 
output.Write("Definition: " + "<b>" + clFld.InnerField.Definition.Name + "</b><br/>"); 
output.Write("Description: " + "<b>" + clFld.InnerField.Description + "</b><br/>"); 
output.Write("Display Name: " + "<b>" + clFld.InnerField.DisplayName + "</b><br/>"); 
output.Write("Has Blob Stream? " + "<b>" + clFld.InnerField.HasBlobStream.ToString() + "</b><br/>"); 
output.Write("Has Value? " + "<b>" + clFld.InnerField.HasValue.ToString() + "</b><br/>"); 
output.Write("ID: " + "<b>" + clFld.InnerField.ID.ToString() + "</b><br/>"); 
output.Write("Contains Inherited Value? " + "<b>" + clFld.InnerField.InheritedValue + "</b><br/>"); 
output.Write("Is Blob Field? " + "<b>" + clFld.InnerField.IsBlobField.ToString() + "</b><br/>"); 
output.Write("Has Been Modified? " + "<b>" + clFld.InnerField.IsModified.ToString() + "</b><br/>"); 
output.Write("Key: " + "<b>" + clFld.InnerField.Key + "</b><br/>"); 
output.Write("Language: " + "<b>" + clFld.InnerField.Language.Name + "</b><br/>"); 
output.Write("Name: " + "<b>" + clFld.InnerField.Name + "</b><br/>"); 
output.Write("Reset Blank On? " + "<b>" + clFld.InnerField.ResetBlank.ToString() + "</b><br/>"); 
output.Write("Section Name: " + "<b>" + clFld.InnerField.Section + "</b><br/>"); 
output.Write("Sort Order: " + "<b>" + clFld.InnerField.Sortorder.ToString() + "</b><br/>"); 
output.Write("Shared? " + "<b>" + clFld.InnerField.Shared.ToString() + "</b><br/>"); 
output.Write("Source: " + "<b>" + clFld.InnerField.Source + "</b><br/>"); 
output.Write("Title: " + "<b>" + clFld.InnerField.Title + "</b><br/>"); 
output.Write("Tooltip: " + "<b>" + clFld.InnerField.ToolTip + "</b><br/>"); 
output.Write("Translatable? " + "<b>" + clFld.InnerField.Translatable.ToString() + "</b><br/>"); 
output.Write("Type: " + "<b>" + clFld.InnerField.Type + "</b><br/>"); 
output.Write("Type Key: " + "<b>" + clFld.InnerField.TypeKey + "</b><br/>"); 
output.Write("Unversioned? " + "<b>" + clFld.InnerField.Unversioned.ToString() + "</b><br/>"); 
output.Write("Validation Regex: " + "<b>" + clFld.InnerField.Validation + "</b><br/>"); 
output.Write("Validation Message: " + "<b>" + clFld.InnerField.ValidationText + "</b><br/>"); 
output.Write("Value: " + "<b>" + clFld.InnerField.Value + "</b>");

output.RenderEndTag(); //Div


Checklist Properties C# Web Control Output

Can Read? True
Can Write? True
Contains Standard Value? True
Definition: Example Checklist
Description: 
Display Name: Example Checklist
Has Blob Stream? False
Has Value? False
ID: {39850FF3-E0D6-4DC0-9D1B-8B2FDE03B622}
Contains Inherited Value? {7AB6F9F7-A1E4-468B-B2CD-13FD3AC7DBC3}|{144E5AF7-7D11-47DE-8633-D8881B1C9C53}
Is Blob Field? False
Has Been Modified? False
Key: example checklist
Language: en
Name: Example Checklist
Reset Blank On? False
Section Name: List Fields
Sort Order: 100
Shared? False
Source: /sitecore/content/Home/ContentAuthors/Content
Title: 
Tooltip: 
Translatable? False
Type: Checklist
Type Key: checklist
Unversioned? False
Validation Regex: 
Validation Message: 
Value: {7AB6F9F7-A1E4-468B-B2CD-13FD3AC7DBC3}|{144E5AF7-7D11-47DE-8633-D8881B1C9C53}