<%@ Page Language="C#" AutoEventWireup="true" Codebehind="DormTreeView.aspx.cs" Inherits="PdmlWeb.Pages.StuDorm.DormTreeView"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<dx:ASPxTreeView ID="dxtvOrg" Width="100%" ShowExpandButtons="true" runat="server"
AutoPostBack="true" OnNodeClick="dxtvOrg_NodeClick">
</dx:ASPxTreeView>
</form>
</body>
</html>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
setTreeViewData();
}
}
protected void dxtvOrg_NodeClick(object source, TreeViewNodeEventArgs e)
{
if (!"ALL".Equals(e.Node.Name))
{
sessionInfo = (sSessionInfo)Session["sessionInfo"];
sessionInfo.dataInfo = e.Node.Name;
sessionInfo.dataInfoTxt = WebUtils.GetOrgAllName((DataTable)Session["dtOrg"], int.Parse(e.Node.Name));
Session.Add("sessionInfo", sessionInfo);
switch (sessionInfo.selectMenu)
{
case eMenuID.DormInfo:
Response.Write("<script>window.parent.window.frames[2].location.href='DormInfo.aspx';</script>");
break;
case eMenuID.DormQuery:
Response.Write("<script>window.parent.window.frames[2].location.href='DormQuery.aspx';</script>");
break;
case eMenuID.DormFinCost:
case eMenuID.DormFinQuery:
Response.Write("<script>window.parent.window.frames[2].location.href='DormFin.aspx';</script>");
break;
case eMenuID.DormFinRpt:
Response.Write("<script>window.parent.window.frames[2].location.href='DormFinRpt.aspx';</script>");
break;
}
}
}
用ASPxTreeView生成动态树,点击树时,第三级节点会向右平铺。注:页面加载时没有任何问题,点击第三级节点时,同级的节点会依次横向排列。
如:第一节点
第二节点
第三节点1
第三节点2
第三节点3
点击后会出现下列这种情况:
第一节点
第二节点
第三节点1
第三节点2
第三节点3
哔哔one