Inheritance: TreeNodeBase
Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string nodeId = context.Request["node"];

            if (!string.IsNullOrEmpty(nodeId))
            {
                TreeNodeCollection nodes = new TreeNodeCollection(false);

                for (int i = 1; i < 6; i++)
                {
                    AsyncTreeNode asyncNode = new AsyncTreeNode();
                    asyncNode.Text = nodeId + i;
                    asyncNode.NodeID = nodeId + i;
                    nodes.Add(asyncNode);
                }

                for (int i = 6; i < 11; i++)
                {
                    TreeNode node = new TreeNode();
                    node.Text = nodeId + i;
                    node.NodeID = nodeId + i;
                    node.Leaf = true;
                    nodes.Add(node);
                }

                context.Response.Write(nodes.ToJson());
                context.Response.End();
            }
        }
Example #2
0
 protected void NodeLoad(object sender, NodeLoadEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.NodeID))
     {
         System.Data.DataTable dtroot = new DataTable();
         if (e.NodeID == "0")
             dtroot = GetFather(e.NodeID);
         else
             dtroot = GetTree(e.NodeID);
         foreach (System.Data.DataRow dr in dtroot.Rows)
         {
             //核心
             if (dr["isleaf"].ToString().Trim() == "0")
             {
                 AsyncTreeNode asyncNode = new AsyncTreeNode();
                 asyncNode.Text = dr["name"].ToString().Trim();
                 asyncNode.NodeID = dr["structid"].ToString().Trim();
                 asyncNode.SingleClickExpand = true;
                 asyncNode.Checked = ThreeStateBool.False;
                 e.Nodes.Add(asyncNode);
             }
             else
             {
                 Ext.Net.TreeNode treeNode = new Ext.Net.TreeNode();
                 treeNode.Text = dr["name"].ToString().Trim();
                 treeNode.NodeID = dr["structid"].ToString().Trim();
                 treeNode.Leaf = true;
                 treeNode.Qtip = dr["structid"].ToString().Trim() + "_" + dr["name"].ToString().Trim();
                 treeNode.Checked = ThreeStateBool.False;
                 treeNode.Icon = Icon.ControlBlankBlue;
                 e.Nodes.Add(treeNode);
             }
         }
     }
 }
        public TreeNodeCollection GetNodes(string node)
        {
            TreeNodeCollection nodes = new TreeNodeCollection(false);

            if (!string.IsNullOrEmpty(node))
            {
                for (int i = 1; i < 6; i++)
                {
                    AsyncTreeNode asyncNode = new AsyncTreeNode();
                    asyncNode.Text = node + i;
                    asyncNode.NodeID = node + i;
                    nodes.Add(asyncNode);
                }

                for (int i = 6; i < 11; i++)
                {
                    TreeNode treeNode = new TreeNode();
                    treeNode.Text = node + i;
                    treeNode.NodeID = node + i;
                    treeNode.Leaf = true;
                    nodes.Add(treeNode);
                }
            }

            return nodes;
        }
Example #4
0
        protected void NodeLoad(object sender, NodeLoadEventArgs e)
        {
            string prefix = e.ExtraParams["prefix"] ?? "";

            if (!string.IsNullOrEmpty(e.NodeID))
            {

                if (e.NodeID.Equals("0"))
                {
                    DataTable table= gbll.GetAllList().Tables[0];

                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        DataRow dr = table.Rows[i];
                        AsyncTreeNode asyncNode = new AsyncTreeNode();
                        asyncNode.Text = dr["Name"].ToString();
                        asyncNode.NodeID = dr["ID"].ToString();
                        e.Nodes.Add(asyncNode);
                    }
                }
                else
                {
                    string tmp=" Gallery={0}";
                    DataTable table = ibll.GetList(string.Format(tmp, e.NodeID));
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        DataRow dr = table.Rows[i];
                        AsyncTreeNode asyncNode = new AsyncTreeNode();
                        asyncNode.Text = dr["Title"].ToString();
                        asyncNode.NodeID = dr["ID"].ToString();
                        asyncNode.Leaf = true;
                        e.Nodes.Add(asyncNode);
                    }
                }
            }
        }