本帖最后由 AaronSL 于 2012-09-27 11:48:08 编辑

解决方案 »

  1.   

    那就用Treeview呗;这是后台动态绑定Treeview;
    <asp:TreeView ID="TVSysFunUpdate" runat="server" Width="89px" Font-Size="Small">
      </asp:TreeView>
     public void DisplayUserMenu()
        {        this.TVSysFunUpdate.Nodes.Clear();        //得到系统菜单表中所有的第一级菜单
            DataSet ds = DbHelperSQL.Query("select * from dbo.shopClass where shopid=" + shopid + " and father=0 order by classorder");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {            //得到第一层节点的Id            string nodeId = ds.Tables[0].Rows[i]["shopClassid"].ToString();            //得到第一层节点的显示名称            string displayName = ds.Tables[0].Rows[i]["shopClassname"].ToString();            //根据节点信息创建一层节点            TreeNode fatherNode = CreateTreeNode(displayName, nodeId, "images/up01.gif");
                CreateChildTree(nodeId, fatherNode);            this.TVSysFunUpdate.Nodes.Add(fatherNode);        }
        }    private TreeNode CreateTreeNode(string strText, string strId, string strImage)
        {        TreeNode newNode = new TreeNode();        newNode.Text = strText;        newNode.Value = strId;        newNode.ImageUrl = strImage;        return newNode;    }    //创建第二级节点    public void CreateChildTree(string nodeId, TreeNode fatherNode)
        {        //在三层下实现获得父级节点为nodeId的所有子节点
            DataSet ds = DbHelperSQL.Query("select * from dbo.shopClass where shopClassid=" + nodeId + " order by classorder");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {            //得到第二层节点Id            string childNodeId = ds.Tables[0].Rows[i]["shopClassid"].ToString();            //得到第二层节点的显示名称            string childDisplayName = ds.Tables[0].Rows[i]["shopClassname"].ToString();
                //根据节点信息,创建第二层节点            TreeNode childNode = CreateTreeNode(childDisplayName, childNodeId, "images/up01.gif");            childNode.Target = "";            childNode.NavigateUrl = "shopGoodsSearch.aspx?ColId=" + childNodeId;            //将子节点加入到父节点中            AddTree(fatherNode, childNode);        }    }    //将子节点加入到父节点中    private void AddTree(TreeNode fatherNode, TreeNode childNode)
        {        fatherNode.ChildNodes.Add(childNode);    }
      

  2.   


    谢谢,不过只有一层节点。关键是Tree的行点击。
      

  3.   

    右边用ListBox吧,用Js控制,想想应该比较容易