it's been a while since I've used Sitecore and I'm struggling with an issue.
There is a model which is being autogenerated by TDS and uses Glassmapper for its mapping.
[SitecoreType(TemplateId=IParametersTemplate_PanelConstants.TemplateIdString, Cachable=false)]
public partial interface IParametersTemplate_Panel : IGlassBase
{
[SitecoreField(IParametersTemplate_PanelConstants.BackGroundColorFieldName)]
Guid BackGroundColor {get; set;}
[SitecoreField(IParametersTemplate_PanelConstants.HasBackgroundColorFieldName)]
bool HasBackgroundColor {get; set;}
}
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public static partial class IParametersTemplate_PanelConstants
{
public const string TemplateIdString = "cbecbd24-8b2d-4694-a4f2-aa888b385cfc";
public static readonly ID TemplateId = new ID(TemplateIdString);
public const string TemplateName = "ParametersTemplate_Panel";
public static readonly ID BackGroundColorFieldId = new ID("7760746c-8e96-4ef9-8d53-bf4428e18100");
public const string BackGroundColorFieldName = "BackGroundColor";
public static readonly ID HasBackgroundColorFieldId = new ID("b7fdfde1-258c-48a8-a934-3425a1c31494");
public const string HasBackgroundColorFieldName = "HasBackgroundColor";
}
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[SitecoreType(TemplateId=IParametersTemplate_PanelConstants.TemplateIdString, Cachable=false)]
public partial class ParametersTemplate_Panel : GlassBase, IParametersTemplate_Panel
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Team Development for Sitecore - GlassItem.tt", "1.0")]
[SitecoreField(IParametersTemplate_PanelConstants.BackGroundColorFieldName)]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Team Development for Sitecore - GlassItem.tt", "1.0")]
[SitecoreField(IParametersTemplate_PanelConstants.HasBackgroundColorFieldName)]
public virtual bool HasBackgroundColor {get; set;}
}
I've added a Droplink field to my template (figure 1.1) called BackGroundColor which points to a datasource that contains 3 items that have keys and values (figure 1.2).
figure 1.2
I would like to get the selected item from the XP editor (figure 2.0) from my droplist so I can map its value (the color class name) to my model.
It's not difficult for a checkbox or something similar but getting a selected item from a droplist seems to be a bit more challenging. Any ideas on how I can make this happen using the current setup ( seeing as my models are being autogenerated)?
thanks.