标题:关于梅花雪树形控件2.0的问题
只看楼主
airfei
Rank: 1
等 级:新手上路
帖 子:137
专家分:0
注 册:2007-4-12
 问题点数:0 回复次数:3 
关于梅花雪树形控件2.0的问题
我在中使用了梅花雪大哥的TreeView 2.0版的。想实现从后台数据库读出数据然后生成树,现在数据都读出了,可就是树不出来,页面显示的是no data,可是我是有数据的呀。还请大家帮忙解答下,谢谢

后台代码:
public partial class Admin_test_test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    public string LoadTree()
    {
        InfoVillage.BLL.IV_Area bll_Area = new InfoVillage.BLL.IV_Area();
        string nodes = "";
        DataSet ds = bll_Area.GetAllList();
        nodes = "var data = {};";
         
        foreach(DataRow dr in ds.Tables[0].Rows)
        {
            if (dr["areaID"].ToString().Length == 2)
            {
                nodes += "data[\"00_" + dr["areaID"].ToString() + "\"] = \"text:" + dr["areaName"].ToString() + ";\";\r\n";
            }
            else if (dr["areaID"].ToString().Length == 4  ? ? dr["areaID"].ToString().Length == 6)
            {
                nodes += "data[\'" + dr["parentID"].ToString() + "_" + dr["areaID"].ToString() + "\'] = \'text:" + dr["areaName"].ToString() + ";\';\r\n";
            }   
        }
        nodes += "Using(\"System.Web.UI.WebControls.MzTreeView\");";
        nodes += "var a = new MzTreeView();";
        nodes += "a.dataSource = data;";
        nodes +=  "a.setJsDataPath(\"csdn/community/treedata/\");";
        nodes += "a.setXmlDataPath(\"csdn/community/treedata/\");";
        //a.rootId="1";
        nodes += "a.autoSort=false;";
        nodes += "a.useCheckbox=true;";
        nodes += "a.canOperate = true;";
        nodes += "document.write(a.render());";
        nodes += "a.expandLevel(1);";
        return nodes;
        true);
    }
}

前台代码:
<%@ Page language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="Admin_test_test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.

<html xmlns="http://www. >
<head runat="server">
     <title>无标题页 </title>
     <script language="javascript" type="text/javascript" src="jsframework.js"> </script>
</head>
<body>
     <form id="form1" runat="server">
     <script language="javascript" type="text/javascript">
     
     <%=LoadTree() %>
     
     </script>
     </form>
</body>
</html>
搜索更多相关主题的帖子: 梅花 树形 控件 数据库 Area 
2008-05-21 10:59
hebingbing
Rank: 6Rank: 6
来 自:黄土高坡
等 级:贵宾
威 望:27
帖 子:3417
专家分:371
注 册:2007-10-22
得分:0 
没有用过这个控件……
2008-05-21 11:05
airfei
Rank: 1
等 级:新手上路
帖 子:137
专家分:0
注 册:2007-4-12
得分:0 
用过的帮帮忙,自己顶
2008-05-21 11:18
OnlyMiss
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2008-5-21
得分:0 
什么什么梅花雪树形控件啊?
听起来挺漂亮的~~~  呵呵 ~~
2008-05-21 16:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-215390-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.729236 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved