[Serializable]
[PageDefinitionTypePlugIn(DisplayName = "Traffic status")]
public class TrafficStatusProperty : EPiServer.Core.PropertyString
{
public override IPropertyControl CreatePropertyControl()
{
return new TrafficStatusPropertyType();
}
public class TrafficStatusPropertyType : EPiServer.Web.PropertyControls.PropertyStringControl
{
RadioButtonList inputControl;
protected override void SetupEditControls()
{
base.SetupEditControls();
TextBox ctrl = this.EditControl;
ctrl.Attributes.Add("style", "display:none");
inputControl = new RadioButtonList();
inputControl.Items.Add(new ListItem(Constants.STATUSNAME_GOOD));
inputControl.Items.Add(new ListItem(Constants.STATUSNAME_MINOR));
inputControl.Items.Add(new ListItem(Constants.STATUSTEXT_MAJOR));
inputControl.SelectedValue = this.PropertyData.Value as string;
this.EditControl.Parent.Controls.Add(inputControl);
}
public override void ApplyEditChanges()
{
if (!String.IsNullOrEmpty(inputControl.SelectedItem.Value))
{
SetValue(inputControl.SelectedItem.Value);
}
}
}
}
My personal C# snippets archive, some EPiServer related. Also my gigs with the bands I play with.
EPiServer CMS 6 - custom property with radiobuttonlist
A simple class for using a radiobuttonlist in a custom property in EPiserver CMS 6.
Prenumerera på:
Kommentarer till inlägget (Atom)
In case of overriding SetupEditControls and hiding the textbox control, you could override CreateEditControls
SvaraRadera/Alf