I've created a Parameters Template with a Treelist Field and a Rendering which uses this Template. That works so far I can select multiple values. But Now I am using this rendering in a dynamic Placeholder and I want to get the Selected Values from my Parameter. The Only thing I get at the moment are Pipe separated GUIDs and I was hoping that I could use MultilistField to get the Values from my selection. But I don't know how to initialize the Multilistfield. Because the Guids I am currently getting with the following Function
public string GetParameter(DynamicPlaceholderRenderContext context, string parameter)
{
var parameterValue = context.Parameters.ContainsKey(parameter) ? context.Parameters[parameter] :
context.Rendering.Parameters.Contains(parameter) ? context.Rendering.Parameters[parameter] :
string.Empty;
return parameterValue;
}
which I Call in my view inside the wrapper Method fpr my DynamicPlaceholder
@Html.Sitecore().DynamicPlaceholder("grid-column", CreateWrapper)
@functions
{
private readonly IParameterTemplatesProvider _parameterTemplatesService = new ParameterTemplatesProvider();
HtmlString CreateWrapper(HtmlString htmlString, DynamicPlaceholderRenderContext context)
{
var cssClasses = _parameterTemplatesService.GetParameter(context, Templates.GridBase.Fields.CssClassesFieldName);
}
}
When I try to get some "context" data like this
var test = Sitecore.Context.Item.Fields[Templates.Column.Fields.CssClassesFieldName];
I get null back but no Object or something else where I can create a MultilistField. I Think I've some prober missunderstandings when I can access
Sitecore.Context.Item or RenderingContext.Current.Rendering.Item how can get the Real Selected values from my Treelist
I am not shure if my problems are associated with DynamicPlaceholders or some other missunderstandings in the sitecore technology :-)