FineUI 官方论坛
标题:
关于手风琴的难题,请大家帮忙找问题
[打印本页]
作者:
不回头的执着
时间:
2013-8-5 22:23
标题:
关于手风琴的难题,请大家帮忙找问题
首次加载后,页面正常显示,单击菜单标题后,所有都收缩,不显示下面的树形菜单,无法展开。另外那个向左的箭头也不起作用。
[attach]2867[/attach] [attach]2868[/attach]
前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Menu.aspx.cs" Inherits="WEB.Menu" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<form id="form1" runat="server">
<x:PageManager ID="PageManager1" runat="server" AutoSizePanelID="RegionPanel1" />
<x:RegionPanel ID="RegionPanel1" runat="server" AutoScroll="True" ShowBorder="false">
<Regions>
<x:Region ID="Region1" runat="server" Position="Left" ShowHeader="true" Split="true" Title="管理导航"
Width="200px" BodyPadding="0 0 5 0" BoxConfigPadding="0 0 5 0" BoxConfigPosition="Left"
AutoScroll="True" EnableAjax="true" EnableCollapse="true" EnableSplitTip="true" CollapseMode="Mini" AutoHeight="True">
<Items>
</Items>
</x:Region>
</Regions>
</x:RegionPanel>
</form>
</body>
</html>
复制代码
后台代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WEB
{
public partial class Menu : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void Page_Init(object sender, EventArgs e)
{
this.BindMenu();
}
protected void BindMenu()
{
#region 首次加载菜单项
List<SAMS.Model.MENU> listm = new SAMS.BLL.MENU().GetModelList("FatherMenuID is null");
var menuAccordion = new FineUI.Accordion();
menuAccordion.ID = "MenuAccordion";
menuAccordion.ShowHeader = false;
menuAccordion.AutoScroll = true;
menuAccordion.ShowBorder = false;
menuAccordion.Height = 150;
for (int i = 0; i < listm.Count; i++)
{
//创建一个AccordionPan
FineUI.AccordionPane accpan = new FineUI.AccordionPane();
//设置AccordionPan的属性
accpan.Title = listm[i].MenuMingCheng;
accpan.ID = "accpan" + i;
accpan.BodyPadding = "2px 0 0 0";
accpan.ShowBorder = false;
accpan.ShowHeader = false;
accpan.AutoHeight = true;
//绑定当前菜单的树型菜单的情况
FineUI.Tree tree = BindTopMenu(listm[i].MenuID);
accpan.Items.Add(tree);
menuAccordion.Items.Add(accpan);
}
this.Region1.Items.Add(menuAccordion);
#endregion
}
/// <summary>
/// 绑定树型菜单的顶级菜单
/// </summary>
/// <param name="fid">顶级菜单的菜单ID</param>
/// <returns></returns>
protected FineUI.Tree BindTopMenu(int fid)
{
List<SAMS.Model.MENU> listm = null;
if (fid == 0)
{
listm = new SAMS.BLL.MENU().GetModelList("");
}
else
{
listm = new SAMS.BLL.MENU().GetModelList("FatherMenuID=" + fid);
}
var treeMenu = new FineUI.Tree();
treeMenu.ShowBorder = false;
treeMenu.ShowHeader = false;
for (int i = 0; i < listm.Count; i++)
{
var node = new FineUI.TreeNode();
node.NavigateUrl = listm[i].MenuURL;
node.Text = listm[i].MenuMingCheng;
node.NodeID = listm[i].MenuID.ToString();
BindMenuTree(treeMenu, node);
treeMenu.Nodes.Add(node);
}
return treeMenu;
}
/// <summary>
/// 绑定树型菜单的下级菜单
/// </summary>
/// <param name="tree">树ID</param>
/// <param name="currentNode">当前节点</param>
protected void BindMenuTree(FineUI.Tree tree, FineUI.TreeNode currentNode)
{
List<SAMS.Model.MENU> subMenu = new SAMS.BLL.MENU().GetModelList("FatherMenuID=" + currentNode.NodeID);
if (subMenu.Count == 0)
{
return;
}
else
{
for (int i = 0; i < subMenu.Count; i++)
{
var node = new FineUI.TreeNode();
node.NavigateUrl = subMenu[i].MenuURL;
node.Text = subMenu[i].MenuMingCheng;
node.NodeID = subMenu[i].MenuID.ToString();
BindMenuTree(tree, node);
node.ParentNode = currentNode;
currentNode.Nodes.Add(node);
}
}
}
}
}
复制代码
作者:
不回头的执着
时间:
2013-8-5 22:34
找了好久,有类似的问题,但不是我这个问题,我真不知道原因在哪里了
作者:
不回头的执着
时间:
2013-8-5 22:41
找到第一个问题:accpan.Layout = FineUI.Layout.Fit;忘记设置了。
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/)
Powered by Discuz! X3.4