• 主页
  • ASP
  • .NET Framework
  • Web Services
  • VB
  • VC
  • 图表区
  • 分析与设计
  • 组件/控件开发
  • LINQ

怎么设置多级菜单

云舒云卷 2013-06-08 01:22:48
前台
<span id="WebSit1"></span>
<div id="LeftBox">
<div id="LeftBox2">
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajaxToolkit:ToolkitScriptManager>
<ajaxToolkit:Accordion ID="MyAccordion" runat="Server" SelectedIndex="0" HeaderCssClass="accordionHeader"
HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent"
AutoSize="None" FadeTransitions="true" TransitionDuration="250" FramesPerSecond="40"
RequireOpenedPane="false" SuppressHeaderPostbacks="true">
<Panes>
</Panes>
<HeaderTemplate>
</HeaderTemplate>
<ContentTemplate>
</ContentTemplate>
</ajaxToolkit:Accordion>
</div>
</div>


后台
private void BindData()
{
SystemModuleInfoController controller = new SystemModuleInfoController();
SystemModuleInfoCollection rootModules = controller.FetchByPid(-1, true);
SystemModuleInfoCollection modules;
AjaxControlToolkit.AccordionPane pane;

foreach (SystemModuleInfo module in rootModules)
{
pane = new AjaxControlToolkit.AccordionPane();
pane.ID = "Pane" + module.ModuleId;
pane.HeaderCssClass = "accordionHeader";
pane.ContentCssClass = "accordionContent";

LiteralControl lc = new LiteralControl();
lc.Text = module.ModuleName;
pane.HeaderContainer.Controls.Add(lc);

modules = controller.FetchByPid(module.ModuleId, true);
lc = new LiteralControl();

foreach (SystemModuleInfo m in modules)
{
//<ul><li><span class='ui-icon circle-arrow-n'></span></li><li><a href='System/Module_Query.aspx' target='main'>模块管理</a></li></ul>

SystemLinkUserRoleController roleController = new SystemLinkUserRoleController();
if (roleController.UserHasLimit(this.UserId, m.ModuleId))
{
//lc.Text += String.Format("<ul><li><span class='{0}'></span></li><li><a href='{1}' target='{2}'>{3}</a></li></ul>", m.ModuleIcon, m.ModuleUrl, m.ModuleTarget, m.ModuleName);
lc.Text += String.Format("<ul><li><span class='{0}'></span></li><li><a href=\"javascript:showPage('{1}','{2}','{3}','{4}','true','true');\" >{5}</a></li></ul>",m.ModuleIcon, m.ModuleUrl, m.ModuleId, m.ModuleName, m.ModuleName, m.ModuleName);
}
}

if (!String.IsNullOrEmpty(lc.Text) && lc.Text.IndexOf("span") > 0)
{
pane.ContentContainer.Controls.Add(lc);
MyAccordion.Panes.Add(pane);
}
}
}
...全文
22 点赞 收藏 回复
写回复
回复

还没有回复,快来抢沙发~

发动态
发帖子
.NET技术社区
创建于2007-09-28

4.9w+

社区成员

66.8w+

社区内容

.NET技术交流专区
社区公告
暂无公告