Try our conversational search powered by Generative AI!


I'll give 500 SEK (+ swedish VAT) to the first person who sends me code for a property plugin as described in this thread: That is, a Yes/No/Inherit control based on Integer. I need it urgently for a project and I don't have the time to solve it. Contact me for details if you're interested. / Ted phone: 0704-67 84 58 (sweden)
Sep 02, 2005 20:22
Good morning. Here you have the code for a dropdown. Add the values to the dropdown from the web.config or a xml-file. using System; using System.Web.UI; using System.Web.UI.WebControls; using EPiServer.Core; using System.Drawing; using System.ComponentModel; using EPiServer.PlugIn; namespace omnion { [PageDefinitionTypePlugIn] public class MyDropdownProperty : PropertyNumber { public override void CreateChildControls(string renderType, System.Web.UI.Control container) { switch(renderType) { case "edit": DropDownList list = new DropDownList(); list.ID = this.Name; CopyWebAttributes(container, list); list.Items.Add( new ListItem("On", "0") ); list.Items.Add( new ListItem("Off", "1") ); container.Controls.Add(list); container.Controls.Add(CreateParseValidator(list)); break; default: base.CreateChildControls(renderType, container); break; } } } } Buy your collegues an icecream with the money and continue work with EPiServer :D /Øyvind ElektroPost Norway
Sep 05, 2005 8:10
:) Thanks a lot! / Ted
Sep 06, 2005 15:11
One small addition just after the calls to list.Items.Add(): list.SelectedValue=this.Value.ToString();
Sep 06, 2005 17:11
You should do a list.Items.FindByValue(...) to make sure you don't try "select" a value that is not in the list. (In case you change the items in the list after first install.)
Sep 08, 2005 13:04
* 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.