AI OnAI Off
I'd use the PropertySelect or write my own custom property for this and just inherit from PropertyString and PropertySelectControlBase.
Eg:
[Serializable]
[PageDefinitionTypePlugIn]
public class PropertyWeekNumberDropDown : PropertyString
{
public override IPropertyControl CreatePropertyControl()
{
return new PropertyWeekNumberDropDownControl();
}
}
public class PropertyWeekNumberDropDownControl : PropertySelectControlBase
{
protected override void SetupEditControls()
{
this.SetupDropDownList();
}
private void SetupDropDownList()
{
this.EditControl.DataSource = GetWeekNumbers;
if (this.WeekNumberDropDown.Value != null)
{
this.EditControl.SelectedValue = this.WeekNumberDropDown.Value as string;
}
this.EditControl.DataBind();
}
private static string[] GetWeekNumbers
{
get
{
var weekNumbers = new string[54];
weekNumbers[0] = "Velg uke";
for (int i = 1; i <= 53; i++)
{
weekNumbers[i] = i.ToString();
}
return weekNumbers;
}
}
public PropertyWeekNumberDropDown WeekNumberDropDown
{
get
{
return PropertyData as PropertyWeekNumberDropDown;
}
}
}
Then in your dynamic content user control:
public PropertyWeekNumberDropDown WeekNumber { get; set; }
Thanks Frederik. Ill give it a shot and see what happens. Appreciate your quick response.
Has anyone done a dropdownlist in dynamic content. I am using the attribute to register the control as a dynamic content object but I am unclear how to render a dropdownlist in the dynamic content setting area. Thanks in advance