Yes/No/Inherit

Vote:
 
I'll give 500 SEK (+ swedish VAT) to the first person who sends me code for a property plugin as described in this thread: http://www.episerver.com/templates/ForumItem____2459.aspx 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) mailto:episerver4devforum@callander.se
#12352
Sep 02, 2005 20:22
Vote:
 
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
#14109
Sep 05, 2005 8:10
Vote:
 
:) Thanks a lot! / Ted
#14110
Sep 06, 2005 15:11
Vote:
 
One small addition just after the calls to list.Items.Add(): list.SelectedValue=this.Value.ToString();
#14111
Sep 06, 2005 17:11
Vote:
 
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.)
#14112
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.