public class GMSRadio : EPiServer.Core.PropertyString
{
public GMSRadio(){}
public override void CreateChildControls(
string renderType,System.Web.UI.Control container)
{
switch(renderType)
{
case "edit":
GMSDescription DynData =
new GMSDescription(this,container,false);
//read items from this.description
RadioButtonList input = new RadioButtonList();
input.ID = Name;
input.RepeatDirection= DynData.direction;
input.TextAlign = DynData.align;
input.RepeatColumns = DynData.iColumns;
input.RepeatLayout = DynData.layout;
foreach (string strItem in DynData.strItems)
{
input.Items.Add(new ListItem(strItem));
}
if(ToString().Length != 0)
{
ListItem selectedItem = input.Items.FindByValue(ToString());
if (selectedItem != null)
selectedItem.Selected = true;
else
input.SelectedIndex = 0;
}
else
input.SelectedIndex = 0;
CopyWebAttributes(container, input);
container.Controls.Add(input);
container.Controls.Add(CreateParseValidator(input));
break;
default:
base.CreateChildControls(renderType,container);
break;
}
}
}