FineUI 官方论坛
标题:
关于“树形菜单+手风琴式菜单”菜单的问题!
[打印本页]
作者:
猪八戒
时间:
2012-3-25 12:21
标题:
关于“树形菜单+手风琴式菜单”菜单的问题!
请教个问题,我在后台绑定“树形菜单+手风琴式菜单”做菜单,要怎么裁定单击菜单打开的也在新的面板里面呢?我看了你的那个JS文件,可是我的TREE是在后台直接生成的,这要怎么做才能绑定你的那个脚本呢?这是的生成菜单的代码:
private void InitMenu()
{
ExtAspNet.Accordion accordion = new ExtAspNet.Accordion();
Region2.Items.Add(accordion);
accordion.ShowBorder = false;
accordion.ShowHeader = false;
try
{
//获取菜单中的所有数据
DataTable Dt_TotleMenu = SelectAll().Tables[0];
//取出所有父节点 因为父节点的Menu_Fid=0
DataRow[] drMenu = Dt_TotleMenu.Select("PMenuCode=0");
//构建父节点的table
DataTable LeftMenuTable = new DataTable();
//克隆一下解构
LeftMenuTable = drMenu[0].Table.Clone();
//导入数据
foreach (DataRow dr in drMenu)
{
LeftMenuTable.ImportRow(dr);
}
//如果存在父节点
if (LeftMenuTable.Rows.Count != 0)
{
//遍历拼接html 根据第一篇观察和抽取HTML的功夫
for (int i = 0; i < LeftMenuTable.Rows.Count; i++)
{
ExtAspNet.AccordionPane pane = new ExtAspNet.AccordionPane();
accordion.Panes.Add(pane);
pane.Title = LeftMenuTable.Rows[i]["MenuName"].ToString();
pane.ShowBorder = false;
//获取当前父节点的所有子节点
DataRow[] drSencondMenu = Dt_TotleMenu.Select("PMenuCode='" + LeftMenuTable.Rows[i]["MenuCode"] + "'");
DataTable SecondTable = new DataTable();
SecondTable = drSencondMenu[0].Table.Clone();
foreach (DataRow dr in drSencondMenu)
{
SecondTable.ImportRow(dr);
}
//如果子存在子节点
if (SecondTable.Rows.Count != 0)
{
ExtAspNet.Tree tree = new ExtAspNet.Tree();
pane.Items.Add(tree);
tree.ShowBorder = false;
tree.ShowHeader = false;
tree.AutoScroll = true;
tree.EnableArrows = true;
//遍历拼接子节点的HTML
foreach (DataRow row in SecondTable.Rows)
{
ExtAspNet.TreeNode node = new ExtAspNet.TreeNode();
node.Text = row["MenuName"].ToString();
node.NavigateUrl = row["FileName"].ToString();
tree.Nodes.Add(node);
}
tree.
}
}
}
return ;
}
catch (Exception err)
{
return;
}
}
欢迎光临 FineUI 官方论坛 (https://fineui.com/bbs/)
Powered by Discuz! X3.4