问题描述
||
我可以控制带有子项目的列表。我需要有一个收集子项的递归函数。
例如,如何收集和迭代包含子项的此收集?
ArrayList MenuItems是要使用的适当类型吗?
<myControl:Menu id=\"MyControl\" runat=\"server\">
<mycontrol:MenuItem Text=\"Hellow World\">
<mycontrol:MenuItem Text=\"Hellow World\">
<mycontrol:MenuItem Text=\"Hellow World\" />
</myControl:menuItem>
</myControl:menuItem>
</myControl:Menu>
这是控件:
public class QuickControl: WebControl
{
private ArrayList MenuItems;
[
Category(\"Behavior\"),Description(\"The contacts collection\"),DesignerSerializationVisibility(
DesignerSerializationVisibility.Content),Editor(typeof(MenuCollectionEditor),typeof(UITypeEditor)),PersistenceMode(PersistenceMode.InnerDefaultProperty)
]
public ArrayList MenuItems
{
get
{
if (MenuList == null)
{
MenuList = new ArrayList();
}
return MenuList;
}
}
// The contacts are rendered in an HTML table.
protected override void RenderContents(
HtmlTextWriter writer)
{
Table t = CreateContactsTable();
if (t != null)
{
t.RenderControl(writer);
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)