Could you please decorate it with design time attributes?

U

Umut Tezduyar

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;
}
}

}

Thank you for spending time on it.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top