please, add design time attributes to my control.

Discussion in 'ASP .Net' started by Umut Tezduyar, Nov 23, 2005.

  1. I really hate working with .net framework design time attributes. I have
    read asp.net server controls and components (Nikhil Kothari, Vandana Datye)
    book, chapter 15 but still i can't handle the complex tasks on designer. The
    thing i want to do is so simple (I hope so). I want my control to understand
    the Menu and SubMenus under Menu. Ex:

    <cc1:MyConrol runat="server" id="MyControl1">
    <Menu name="level1">
    <SubMenus>
    <Menu name="level2">
    <SubMenus>
    <Menu name="level3"/>
    </SubMenus>
    </Menu>
    <Menu name="level4"/>
    </SubMenus>
    </Menu>
    </cc1:MyControl>

    It should parse child controls and also by using the property browser, i
    should add 'Menu' and 'SubMenus' to my control. Should i use
    'ExpandableObjectConverter' for my MyControl control?

    Could you please fully decorate this control and Menu to give a full design
    time support?

    Here is the code:

    [ToolboxData("<{0}:MyControl runat=server></{0}:MyControl>")]
    public class MyControl : System.Web.UI.Control
    {
    private Menu _menu;

    // This is not the only propery. Not DefaultInnerPropery
    public Menu Menu
    {
    get
    {
    return this._menu;
    }
    set
    {
    this._menu = value;
    }
    }
    }

    // This is not a control
    public class Menu
    {
    private string _name;

    // Menu collection is a collection only holds Menu in it.
    private MenuCollection _subMenus;

    public Menu()
    {

    }

    public string Name
    {
    get
    {
    return this._name;
    }
    set
    {
    this._name = value;
    }
    }

    public MenuCollection SubMenus
    {
    get
    {
    return this._subMenus;
    }
    set
    {
    this._subMenus = value;
    }
    }

    }
     
    Umut Tezduyar, Nov 23, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    723
  2. Umut Tezduyar
    Replies:
    0
    Views:
    423
    Umut Tezduyar
    Nov 22, 2005
  3. P4trykx
    Replies:
    2
    Views:
    1,826
    bruce barker
    Jan 31, 2007
  4. flamesrock
    Replies:
    8
    Views:
    476
    Hendrik van Rooyen
    Nov 24, 2006
  5. Replies:
    1
    Views:
    382
    Teemu Keiski
    Jul 2, 2003
Loading...

Share This Page