Grp DLink Properties

Grp DLink Properties

Grouped Droplink Fields

  • Store field values as GUID
  • There is no web control for use in declarative markup
  • Not supported by FieldRenderer.Render() method or FieldRenderer control
  • Supported by Sitecore.Data.Fields.ReferenceField class in Sitecore API
  • Support use of Sitecore Query to filter on source property
  • Does not natively support displaying field values in the Page Editor

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Context
  • Sitecore.Data.Database
  • Sitecore.Data.Fields.ReferenceField
  • Sitecore.Data.Items.Item
  • Sitecore.MainUtil

Grouped Droplink C# Web Control Code

//get Link Fields metadata item from context database using item guid
Sitecore.Data.Database db = Sitecore.Context.Database;
Sitecore.Data.Items.Item item = db.GetItem("{E3B7CC3C-8C55-4401-A3C9-0FEA9CDA3E9C}");
if (item == null) return;

Sitecore.Data.Fields.ReferenceField grpedDLink = item.Fields["example grouped droplink"];
if (grpedDLink == null) return;

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();

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", grpedDLink.InnerField.DisplayName);
output.RenderEndTag(); //P

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

output.RenderEndTag(); //Div


Grouped Droplink C# Web Control Output

Path: {DB042F8F-88B2-4A55-A117-9E6185C2F826}
Target ID: {DB042F8F-88B2-4A55-A117-9E6185C2F826}
Target Item Name: AncestorAxis
Can Read? True
Can Write? True
Contains Standard Value? False
Definition: Example Grouped Droplink
Description: 
Display Name: Example Grouped Droplink
Has Blob Stream? False
Has Value? True
ID: {19DE58D9-31E2-49AA-8C2C-E07BFA7FE8DA}
Contains Inherited Value? {DB042F8F-88B2-4A55-A117-9E6185C2F826}
Is Blob Field? False
Has Been Modified? False
Key: example grouped droplink
Language: en
Name: Example Grouped Droplink
Reset Blank On? False
Section Name: Link Fields
Sort Order: 200
Shared? False
Source: /sitecore/content/home/developers
Title: 
Tooltip: 
Translatable? False
Type: Grouped Droplink
Type Key: grouped droplink
Unversioned? False
Validation Regex: 
Validation Message: 
Value: {DB042F8F-88B2-4A55-A117-9E6185C2F826}