a Composite control with design-time support RRS feed

  • Question

  • User61101408 posted

    Do you know any good examples of a collection Editor in a composite control ?

    Thursday, July 2, 2009 8:47 AM


  • User-2106054853 posted


    From your description you want to use an editor to edit a property of your custom composite control, right? If so you can either use the built-in Editor, like below, or write your own editor (if you want to do so please use reflector to view the source code of existing editor to see how to write it)


            <cc1:MyControl ID="MyControl1" runat="server">


      [ParseChildren(true, "Items")]
        public class MyControl : CompositeControl
            public MyControl() {
                this.PreRender += new EventHandler(MyControl_PreRender);

            void MyControl_PreRender(object sender, EventArgs e)
                foreach (ListItem li in this.items)
                    TextBox tb = new TextBox() { Text = li.Text };


            private ListItemCollection items;

            Editor("System.Web.UI.Design.WebControls.ListItemsCollectionEditor,System.Design, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
                typeof(UITypeEditor)), MergableProperty(false)]
            public virtual ListItemCollection Items
                    if (this.items == null)
                        this.items = new ListItemCollection();
                    return this.items;


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 6, 2009 4:20 AM