Try our conversational search powered by Generative AI!

Radio buttons property type

I would like to assign radio buttons (Y/N, 1/0, true/false or customization) to a property I can put on a page template. IMHO, this whould be nice to have in the standard set of properties.
Mar 02, 2005 11:23
I have created a custom radio button property based on string. The challenge is how to get the radio buttons elements for displaying the selections to the user. I am using the Description field for storing this settings. However this is not optional because of the length limitations to this field. 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; } } }
Mar 03, 2005 10:08
This thread is locked and should be used for reference only.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.