树目录
无标题页body{padding:0;margin:0;background-color: #FFF;font-size: 12px;}.btn{cursor: pointer;color: #0066FF;font-size: 12px;}$(function() {$('#demo4').lightTr
·
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="zzlist.aspx.cs" Inherits="Budget_zz_zzlist" %>
<!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>无标题页</title>
<link href="tree/jquery.lightTreeview.css" rel="stylesheet" type="text/css" />
<script src="tree/jquery-1.2.6.js" type="text/javascript"></script>
<script src="tree/jquery.lightTreeview.pack.js" type="text/javascript"></script>
<style type="text/css">
body
{
padding:0;
margin:0;
background-color: #FFF;
font-size: 12px;
}
.btn
{
cursor: pointer;
color: #0066FF;
font-size: 12px;
}
</style><script type="text/javascript">
$(function() {
$('#demo4').lightTreeview({
collapse: true,
line: true,
nodeEvent: false,
unique: false,
style: 'default',
animate: 400,
fileico: true,
folderico: true
});
});
</script>
<link href="../../css/css.css" rel="Stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<table width="100%" border="0" align="center" id="content">
<tr class="top" align="center">
<td colspan="2">
组织结构
</td>
</tr>
<tr>
<td width="180" valign="top">
<ul id="demo4" class="lightTreeview" style="margin-left: -30px;">
<%=str%>
</ul>
</td><td valign="top">
<iframe src="zzlists.aspx" id="Iframe_Main" name="Iframe_Main" width="100%" frameborder="0"
scrolling="no" οnlοad="this.height=this.contentWindow.document.documentElement.scrollHeight">
</iframe>
</td>
</tr>
</table>
</form>
</body>
</html>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
public partial class Budget_zz_zzlist : System.Web.UI.Page
{
protected StringBuilder str = new StringBuilder();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillTreeView("-1", 1);
}
}
protected void FillTreeView(string pid, int l)
{
try
{
DataTable dt = new Budget.BLL.CompanyCode().GetList("Pid=" + pid + " Order by id").Tables[0];
if (pid == "-1")
{
str.AppendLine("<ul class=\"t-file\">");
}
if (dt.Rows.Count > 0 && pid != "-1")
{
string ul = (pid=="9") ? "<ul>" : "<ul style=\"display:none\">";
str.AppendLine(ul);
}
for (int i = 0; i < dt.Rows.Count; i++)
{
str.AppendLine("<li><div><a href='zzlists.aspx?CAllName=" + dt.Rows[i]["CAllName"] + "&CCode=" + dt.Rows[i]["CCode"] + "&CShortName=" + dt.Rows[i]["CShortName"] + "&id=" + dt.Rows[i]["id"] + "' target=\"Iframe_Main\">" + dt.Rows[i]["CShortName"] + "</a></div>");
FillTreeView(dt.Rows[i]["id"].ToString(), l + 1);
}
if (dt.Rows.Count > 0 && pid != "9")
{
str.AppendLine("</ul>");
}
if (pid == "-1")
{
str.AppendLine("</ul>");
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
Response.End();
}
}
}
更多推荐
已为社区贡献1条内容
所有评论(0)