本帖最后由 Xiaonn 于 2013-2-19 13:30 编辑
用IE8浏览器是空白的,用360浏览器可以正常显示???什么原因啊。我用的是FineUI3.23;代码如下:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace FineUI.Examples
{
public partial class ACS_Index : PageBase
{
#region Page_Init
protected void Page_Init(object sender, EventArgs e)
{
if (Session["username"] == "" | Session["username"] == null)
{
Response.Redirect("../login.aspx?sys=ACS");
}
else
{
txtUsreName.Text = "欢迎您:" + Session["username"].ToString();
}
// 注册客户端脚本,服务器端控件ID和客户端ID的映射关系
JObject ids = GetClientIDS(mainTabStrip);
//手风琴+树菜单
Accordion accordionMenu = InitAccordionMenu();
ids.Add("mainMenu", accordionMenu.ClientID);
ids.Add("menuType", "accordion");
// 只在页面第一次加载时注册客户端用到的脚本
if (!Page.IsPostBack)
{
string idsScriptStr = String.Format("window.IDS={0};", ids.ToString(Newtonsoft.Json.Formatting.None));
PageContext.RegisterStartupScript(idsScriptStr);
}
}
private Accordion InitAccordionMenu()
{
Accordion accordionMenu = new Accordion();
accordionMenu.ID = "accordionMenu";
accordionMenu.EnableFill = true;
accordionMenu.ShowBorder = false;
accordionMenu.ShowHeader = false;
Region2.Items.Add(accordionMenu);
XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();
XmlNodeList xmlNodes = xmlDoc.SelectNodes("/Tree/TreeNode");
foreach (XmlNode xmlNode in xmlNodes)
{
if (xmlNode.HasChildNodes)
{
AccordionPane accordionPane = new AccordionPane();
accordionPane.Title = xmlNode.Attributes["Text"].Value;
accordionPane.Layout = Layout.Fit;
accordionPane.ShowBorder = false;
accordionPane.BodyPadding = "2px 0 0 0";
accordionMenu.Items.Add(accordionPane);
Tree innerTree = new Tree();
innerTree.EnableArrows = true;
innerTree.ShowBorder = false;
innerTree.ShowHeader = false;
innerTree.EnableIcons = false;
innerTree.AutoScroll = true;
accordionPane.Items.Add(innerTree);
XmlDocument innerXmlDoc = new XmlDocument();
innerXmlDoc.LoadXml(String.Format("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Tree>{0}</Tree>", xmlNode.InnerXml));
// 绑定AccordionPane内部的树控件
innerTree.DataSource = innerXmlDoc;
innerTree.DataBind();
}
}
return accordionMenu;
}
private JObject GetClientIDS(params ControlBase[] ctrls)
{
JObject jo = new JObject();
foreach (ControlBase ctrl in ctrls)
{
jo.Add(ctrl.ID, ctrl.ClientID);
}
return jo;
}
#endregion
#region Page_Load
protected void Page_Load(object sender, EventArgs e)
{
}
#endregion
}
}
|