protected internal TreeNode buildApplicationsTreeView()
 {
     if (this.applications != null && this.applications.Length > 0)
     {
         this.storage.OpenConnection();
         this.itemsHierarchyTreeView.Nodes.Clear();
         TreeNode root = new TreeNode("NetSqlAzMan", "NetSqlAzMan", this.getImageUrl("NetSqlAzMan_16x16.gif"));
         root.ToolTip = ".NET Sql Authorization Manager";
         this.itemsHierarchyTreeView.Nodes.Add(root);
         TreeNode storeNode = new TreeNode(this.applications[0].Store.Name, this.applications[0].Store.Name, this.getImageUrl("Store_16x16.gif"));
         root.ChildNodes.Add(storeNode);
         root.Expand();
         storeNode.Expand();
         storeNode.ToolTip = this.applications[0].Store.Description;
         for (int i = 0; i < this.applications.Length; i++)
         {
             this.add(storeNode, this.applications[i]);
             storeNode.Expand();
         }
         this.storage.CloseConnection();
         root.Expand();
         storeNode.Expand();
         return root;
     }
     else
     {
         return null;
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string forum_id = "-0";

            forum_id = Request.QueryString["forum"];
            if (forum_id != null)
            {

                TreeView treeForum;
                Conector con = new Conector();
                treeForum = this.TreeView1;

                SqlDataReader SabForum;
                SabForum = con.select("SELECT     id, forum, name, description, position FROM         subforum WHERE     (forum = " + forum_id + ") ORDER BY position DESC");
                while (SabForum.Read())
                {
                    TreeNode t = new TreeNode(SabForum[2].ToString());
                    t.NavigateUrl = "~/Forum/ShowTopic.aspx?forum=" + SabForum[1].ToString() + "&subforum=" + SabForum[0].ToString();
                    treeForum.Nodes.Add(t);
                }
                con.con_close();
            }
            else
                Response.Redirect("~/Default.aspx");
        }
        /// <summary>
        /// Retrieves the differnt facet members to be placed into TreeNode objects for disaply
        /// </summary>
        /// <param name="name"></param>
        /// <param name="f"></param>
        /// <returns></returns>
        private TreeNode GetTreeNode(string name, IElement f, string path)
        {
            TreeNode tn = new TreeNode();

            IEnumerable<IModelMember> facetMembers = ContactFacetsHelper.FacetFactory.GetFacetMembers(f);

            tn.Text = name;
            tn.Value = path;
            if (facetMembers != null && facetMembers.Any())
            {
                foreach (IModelMember modelMember in facetMembers)
                {
                    if (modelMember is IModelAttributeMember && !string.Equals(modelMember.Name, "Preferred", StringComparison.OrdinalIgnoreCase))
                    {
                        var newItemPath = string.Format("{0}/{1}", path, modelMember.Name);
                        var newNode = new TreeNode(modelMember.Name, newItemPath);
                        newNode.Selected = newItemPath.ToLowerInvariant() == this.MappedFields.Value.ToLowerInvariant();
                        tn.ChildNodes.Add(newNode);
                    }
                    else if (modelMember is IModelElementMember)
                    {
                        IModelElementMember modelElementMember = modelMember as IModelElementMember;
                        tn.ChildNodes.Add(GetTreeNode(modelElementMember.Name, modelElementMember.Element, string.Format("{0}/{1}", path, modelElementMember.Name)));
                    }
                    else if (modelMember is IModelDictionaryMember || modelMember is IModelCollectionMember)
                    {
                        IModelDictionaryMember dictionaryMember = modelMember as IModelDictionaryMember;
                        Type type = dictionaryMember == null ? Enumerable.Single<Type>((IEnumerable<Type>)(modelMember as IModelCollectionMember).Elements.GetType().GetGenericArguments()) : Enumerable.Single<Type>((IEnumerable<Type>)dictionaryMember.Elements.GetType().GetGenericArguments());
                        if (!(type == (Type)null))
                            tn.ChildNodes.Add(GetTreeNode("Entries", ContactFacetsHelper.FacetFactory.CreateElement(type), string.Format("{0}/{1}", path, "Entries")));
                    }
                }
            }
            return tn;
        }
Пример #4
0
        private void PopulateNodes2(TreeNodeCollection nodes, int parent)
        {
            ZhuJi.Portal.IDAL.IPlugin plugin = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Plugin)) as ZhuJi.Portal.IDAL.IPlugin;
            IList<ZhuJi.Portal.Domain.Plugin> list = plugin.GetObjects();

            ZhuJi.Portal.Domain.PluginCollection plugins = new ZhuJi.Portal.Domain.PluginCollection();
            DataTable dt = plugins.CreateDateTable(list);

            DataRow[] drs = dt.Select(string.Format("[Parent] = {0}", parent));
            if (drs.Length == 0)
            {
                return;
            }
            else
            {
                foreach (DataRow dr in drs)
                {
                    TreeNode tn = new TreeNode();
                    tn.Text = dr["Title"].ToString();
                    tn.Value = dr["Id"].ToString();
                    if (dt.Select(string.Format("[Parent] = {0}", tn.Value)).Length > 0)
                    {
                        tn.PopulateOnDemand = true;
                    }
                    tn.NavigateUrl = string.Format("AddIn.aspx?PluginId={0}", dr["Id"]);
                    nodes.Add(tn);
                }
            }
        }
Пример #5
0
 public TreeNode Clone(TreeNode treeNode)
 {
     TreeNode returnNode = new TreeNode
                               {
                                   Checked = treeNode.Checked,
                                   NavigateUrl = treeNode.NavigateUrl,
                                   Text = treeNode.Text,
                                   ToolTip = treeNode.ToolTip,
                                   Expanded = treeNode.Expanded,
                                   ImageUrl = treeNode.ImageUrl,
                                   ImageToolTip = treeNode.ImageToolTip,
                                   PopulateOnDemand = treeNode.PopulateOnDemand,
                                   SelectAction = treeNode.SelectAction,
                                   Selected = treeNode.Selected,
                                   Value = treeNode.Value,
                                   ShowCheckBox = treeNode.ShowCheckBox,
                                   Target = treeNode.Target
                               };
     foreach (TreeNode node in treeNode.ChildNodes)
     {
         TreeNode clonedNode = Clone(node);
         returnNode.ChildNodes.Add(clonedNode);
     }
     return returnNode;
 }
        protected void AddProperty_Click(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.TreeNode PropertyNode = new System.Web.UI.WebControls.TreeNode();
            System.Web.UI.WebControls.TreeNode OptionsNode  = new System.Web.UI.WebControls.TreeNode();
            string TimeStr = DateTime.Now.ToShortTimeString();

            OptionsNode.Text  = "Options";
            OptionsNode.Value = TimeStr + "1";
            OptionsNode.ChildNodes.Add(new System.Web.UI.WebControls.TreeNode("Option【新选项】", TimeStr + "2"));
            OptionsNode.ChildNodes.Add(new System.Web.UI.WebControls.TreeNode("Option【新选项】", TimeStr + "3"));

            PropertyNode.Text  = "Property";
            PropertyNode.Value = TimeStr + "4";
            PropertyNode.ChildNodes.Add(new System.Web.UI.WebControls.TreeNode("Name【新特性】", TimeStr + "5"));
            PropertyNode.ChildNodes.Add(new System.Web.UI.WebControls.TreeNode("Question", TimeStr + "6"));
            PropertyNode.ChildNodes.Add(OptionsNode);


            for (int i = 0; i < TreeViewFinding.Nodes[0].ChildNodes.Count; i++)
            {
                string CurNodeText = TreeViewFinding.Nodes[0].ChildNodes[i].Text.Trim();
                if (CurNodeText == "Properties")
                {
                    TreeViewFinding.Nodes[0].ChildNodes[i].ChildNodes.Add(PropertyNode);
                    TreeViewFinding.Nodes[0].ChildNodes[i].Selected = true;
                    break;
                }
            }
        }
        //将Xml类型转化成treeview类型
        private void XmlToTreeview(XmlNodeList xmlNodeList, System.Web.UI.WebControls.TreeNodeCollection treeNode)
        {
            int    CurOrder = 0;
            string CurTime  = DateTime.Now.ToLongTimeString();

            foreach (XmlNode xmlNode in xmlNodeList)
            {
                if (xmlNode.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                System.Web.UI.WebControls.TreeNode newTreeNode = new System.Web.UI.WebControls.TreeNode();
                newTreeNode.Text  = xmlNode.LocalName;
                newTreeNode.Value = CurTime + CurOrder.ToString();
                CurOrder++;
                if (xmlNode.HasChildNodes)
                {
                    if (xmlNode.ChildNodes[0].NodeType == XmlNodeType.Text)
                    {
                        newTreeNode.Text += " 【 " + xmlNode.ChildNodes[0].Value + "】";
                        //newTreeNode.Value = xmlNode.ChildNodes[0].Value;
                        newTreeNode.Value = CurTime + CurOrder.ToString();
                        CurOrder++;
                    }
                    XmlToTreeview(xmlNode.ChildNodes, newTreeNode.ChildNodes);
                }
                treeNode.Add(newTreeNode);
            }
        }
Пример #8
0
    protected void treeElem_RootNodeCreated(object sender, EventArgs e)
    {
        // Add "Unassigned products" node when global products or products without document allowed
        if (AllowGlobalObjects || AllowProductsWithoutDocuments)
        {
            UITreeView treeControl = sender as UITreeView;
            if (treeControl != null)
            {
                System.Web.UI.WebControls.TreeNode newNode = new System.Web.UI.WebControls.TreeNode();
                string imageUrl = GetImageUrl("Objects/Ecommerce_SKU/list.png");
                string tooltip  = GetString("com.productstree.unassignedtooltip");

                // Set the base data
                newNode.Value       = "-1";
                newNode.NavigateUrl = "javascript:void(0);";

                // Prepare icon
                StringBuilder sb = new StringBuilder();
                sb.Append("<img src=\"", imageUrl, "\" alt=\"\" style=\"border:0px;vertical-align:middle;\" onclick=\"return false;\"", HttpUtility.HtmlEncode(tooltip), " class=\"", "Image20", "\" />");
                string imageTag = sb.ToString();

                // Prepare name
                string nodeName     = HttpUtility.HtmlEncode(GetString("com.productstree.unassigned"));
                string nodeNameJava = ScriptHelper.GetString(nodeName);

                newNode.Text = treeElem.NodeTextTemplate.Replace("##NODEID##", "-1").Replace("##NODENAMEJAVA##", nodeNameJava).Replace("##NODENAME##", nodeName).Replace("##ICON##", imageTag);

                const int childNodesCount = 0;
                newNode.Text = newNode.Text.Replace("##NODECHILDNODESCOUNT##", childNodesCount.ToString());

                // Insert node to the top of tree
                treeControl.Nodes.AddAt(0, newNode);
            }
        }
    }
Пример #9
0
        //����ڵ�����
        protected void RenderNode( TreeNode n ,    HtmlTextWriter writer )
        {
            writer.WriteLine( "<table border=0 cellspacing=3 cellpadding=0 height='100%' >" );
            writer.Write( "<td " );
            writer.Write( NodeExtendTag );
            writer.Write( ">" );

            if (String.IsNullOrEmpty(n.NavigateUrl))
            {
                writer.Write(n.Text);
            }
            else
            {
                writer.Write("<a href='");
                writer.Write(n.NavigateUrl);
                writer.Write("' target='");
                writer.Write(n.Target);
                writer.Write("' title='");
                writer.Write(n.ToolTip);
                writer.Write("' >");
                writer.Write(n.Text);
                writer.Write("</a>");
            }

            writer.Write( "</td>" );
            writer.WriteLine( "</table>" );
        }
Пример #10
0
    /// <summary>
    /// Adds node to the root node.
    /// </summary>
    /// <param name="nodeName">Name of node</param>
    /// <param name="boardId">Message board identifier</param>
    private void AddNode(string nodeName, int boardId, bool group)
    {
        TreeElemNode newNode  = new TreeElemNode();
        string       cssClass = "ContentTreeItem";
        string       elemId   = string.Empty;

        string url = group ? groupNavUrl : navUrl;

        // Select proper node
        if ((!selectedSet) && String.IsNullOrEmpty(selectedNodeName))
        {
            if (!RequestHelper.IsPostBack())
            {
                hdnBoardId.Value = boardId.ToString();
            }
            ltlScript.Text += ScriptHelper.GetScript("parent.frames['main'].location.href = '" + url + "&boardid=" + boardId + "'");
            selectedSet     = true;
            cssClass        = "ContentTreeSelectedItem";
            elemId          = "id=\"treeSelectedNode\"";
        }
        if (selectedNodeName == nodeName)
        {
            cssClass = "ContentTreeSelectedItem";
            elemId   = "id=\"treeSelectedNode\"";
        }

        newNode.Text        = "<span class=\"" + cssClass + "\" " + elemId + " onclick=\"SelectNode(" + ScriptHelper.GetString(HttpUtility.UrlEncode(nodeName)) + ", this, " + boardId + ", '" + url + "');\"><span class=\"Name\">" + HTMLHelper.HTMLEncode(nodeName) + "</span></span>";
        newNode.ImageUrl    = GetImageUrl("Objects/Board_Board/list.png");
        newNode.NavigateUrl = "#";

        treeElem.Nodes[0].ChildNodes.Add(newNode);

        return;
    }
Пример #11
0
        //递归添加树的节点
        public void AddTree(int ParentID, TreeNode pNode)
        {
            DataSet ds = (DataSet)this.ViewState["ds"];
            DataView dvTree = new DataView(ds.Tables[0]);
            //过滤ParentID,得到当前的所有子节点
            dvTree.RowFilter = "[c_parent_id] = " + ParentID;

            foreach (DataRowView Row in dvTree)
            {
                TreeNode Node = new TreeNode();
                if (pNode == null)
                {    //添加根节点
                    Node.Text = Row["c_province_name"].ToString();
                    TreeView1.Nodes.Add(Node);
                    Node.Expanded = true;
                    AddTree(Int32.Parse(Row["c_id"].ToString()), Node);    //再次递归
                }
                else
                {   //̀添加当前节点的子节点
                    Node.Text = Row["c_province_name"].ToString();
                    pNode.ChildNodes.Add(Node);
                    Node.Expanded = true;
                    AddTree(Int32.Parse(Row["c_id"].ToString()), Node);     //再次递归
                }
            }
        }
Пример #12
0
 public static void RschPropsListBuilder(TreeView tw, int rschId)
 {
     var tasks = TaskManager.GetTasks(rschId).ToList<Task>();
     List<TaskNode> taskNodes = new List<TaskNode>();
     foreach (var task in tasks)
     {
         if (tw.Nodes.Count == 0)
         {
             tw.Nodes.Add(new TreeNode(TaskManager.GetTaskDescription(task.Type)));
             tw.Nodes[0].ChildNodes.Add(new TreeNode(task.Value));
         }
         else
         {
             bool placed = false;
             foreach (TreeNode n in tw.Nodes)
             {
                 if (n.Text == TaskManager.GetTaskDescription(task.Type))
                 {
                     n.ChildNodes.Add(new TreeNode(task.Value));
                     placed = true;
                 }
             }
             if (!placed)
             {
                 TreeNode tnode = new TreeNode(TaskManager.GetTaskDescription(task.Type));
                 tnode.ChildNodes.Add(new TreeNode(task.Value));
                 tw.Nodes.Add(tnode);
             }
         }
         //taskNodes.Add(new TaskNode(){Description = TaskManager.GetTaskDescription(task.Type), Value = task.Value});
     }
     //TaskManager.GetTaskDescription(1);
 }
Пример #13
0
 /// <summary>
 /// Genera el menu apartir de los resultados de la base de datos
 /// </summary>
 private void GenerarMenu()
 {
     List<MENU> menus = null;
     List<MENU> menusPadres = null;
     List<MENU> submenus = null;
     TreeNode item;
     TreeNode subitem;
     menus = (List<MENU>)Session["Menu"];
     menus = menus.OrderBy(menu => menu.NIVELMENU).ToList();
     menusPadres = menus.Where(menu => menu.NIVELMENU == 0).ToList();
     menusPadres.ForEach(padre =>
     {
         submenus = menus.Where(x => x.IDMENUPADRE == padre.IDMENU).ToList();
         item = new TreeNode
         {
             Value = padre.DESCRIPCIONMENU,
             NavigateUrl = padre.RUTA
         };
         TreeViewMenu.Nodes.Add(item);
         submenus.ForEach(submenu =>
         {
             subitem = new TreeNode
             {
                 Value = submenu.DESCRIPCIONMENU,
                 NavigateUrl = submenu.RUTA
             };
             item.ChildNodes.Add(subitem);
         });
     });
 }
Пример #14
0
        int PopulateTreeView(TagElements parentTag, int curentPosition, TreeNode parentNode)
        {
            // parentTag.hierarchicalPosition = curentPosition;

            int j = 0;
            foreach (TagElements tag in tagMap)
            {
                if (tag == null) break;

                if (tag.parentName == parentTag.tagName)
                {
                    TreeNode curentNode = new TreeNode();
                    curentNode.Text = tag.tagName;
                    curentNode.NavigateUrl = "TagInfo.aspx?tagName=" + tag.tagName;
                    curentNode.Collapse();
                    parentNode.ChildNodes.Add(curentNode);
                    PopulateTreeView(tag, curentPosition + 1, curentNode);
                }

                j++;

                // Response.Write(tag.tagName + "   " + tag.parentName + "<br />");
            }

            return 0;
        }
Пример #15
0
 private void show_phongban()
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         DataSet ds = ob.fillDataset("EXEC ChungNT.KeHoach_TongHop_DonVi");
         DataView dv = ds.Tables[0].DefaultView;
         TreeNode child;
         foreach (TreeNode node in tvPhongBan.Nodes)
         {
             dv.RowFilter = string.Format("GroupID = '{0}'", node.Value);
             for (int i = 0; i < dv.Count; i++)
             {
                 child = new TreeNode();
                 child.Value = dv[i][0].ToString();
                 child.Text = dv[i][1].ToString();
                 child.ShowCheckBox = true;
                 child.SelectAction = TreeNodeSelectAction.None;
                 node.ChildNodes.Add(child);
             }
         }
         lbError.Text = "";
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
Пример #16
0
        /// <summary>
        /// 查找数型控件节点
        /// </summary>
        /// <param name="ParentNode">父节点</param>
        /// <param name="Url">Url</param>
        /// <returns>Url所在节点</returns>
        private TreeNode FindNode(System.Web.UI.WebControls.TreeNode ParentNode, string Url)
        {
            if (ParentNode.ChildNodes.Count == 0)
            {
                return(null);
            }
            TreeNode rNode = new TreeNode();

            rNode = null;
            foreach (TreeNode node in ParentNode.ChildNodes)
            {
                if (node.NavigateUrl.ToString() == Url)
                {
                    return(node);
                }
                else
                {
                    rNode = FindNode(node, Url);
                    if (rNode != null)
                    {
                        return(rNode);
                    }
                }
            }
            return(rNode);
        }
Пример #17
0
        private void WriteNodeLink(TreeView treeView, System.Web.UI.WebControls.TreeNode item, HtmlTextWriter writer)
        {
            writer.WriteBeginTag("a");
            writer.WriteAttribute("href", ToAbsolute(item));

            if (item.Selected)
            {
                writer.WriteAttribute("class", "selected");
            }

            if (!string.IsNullOrEmpty(item.Target))
            {
                writer.WriteAttribute("target", item.Target);
            }
            else if (!string.IsNullOrEmpty(this.Target))
            {
                writer.WriteAttribute("target", this.Target);
            }

            if (!string.IsNullOrEmpty(item.ToolTip))
            {
                writer.WriteAttribute("title", item.ToolTip);
            }
            else if (!string.IsNullOrEmpty(treeView.ToolTip))
            {
                writer.WriteAttribute("title", treeView.ToolTip);
            }
            writer.Write(HtmlTextWriter.TagRightChar);

            WriteNodeImage(treeView, item, writer);
            writer.Write(item.Text);

            writer.WriteEndTag("a");
        }
Пример #18
0
        private void AddNode(XmlNode inXmlNode, TreeNode inTreeNode)
        {
            XmlNode xNode;
            TreeNode tNode;
            XmlNodeList nodeList;
            int i;

            // Loop through the XML nodes until the leaf is reached.
            // Add the nodes to the TreeView during the looping process.
            if (inXmlNode.HasChildNodes)
            {
                nodeList = inXmlNode.ChildNodes;
                for (i = 0; i <= nodeList.Count - 1; i++)
                {
                    xNode = inXmlNode.ChildNodes[i];
                    inTreeNode.ChildNodes.Add(new TreeNode(xNode.Name));
                    tNode = inTreeNode.ChildNodes[i];
                    AddNode(xNode, tNode);
                }
            }
            else
            {
                // Here you need to pull the data from the XmlNode based on the
                // type of node, whether attribute values are required, and so forth.
                inTreeNode.Text = (inXmlNode.OuterXml).Trim();
            }
        }
Пример #19
0
        /// <summary>
        /// 绑定生成一个有树结构的下拉菜单
        /// </summary>
        /// <param name="dtNodeSets">菜单记录数据所在的表</param>
        /// <param name="strParentColumn">表中用于标记父记录的字段</param>
        /// <param name="strRootValue">第一层记录的父记录值(通常设计为0或者-1或者Null)用来表示没有父记录</param>
        /// <param name="strIndexColumn">索引字段,也就是放在DropDownList的Value里面的字段</param>
        /// <param name="strTextColumn">显示文本字段,也就是放在DropDownList的Text里面的字段</param>
        /// <param name="drpBind">需要绑定的DropDownList</param>
        /// <param name="i">用来控制缩入量的值,请输入-1</param>
        public static void MakeTree(DataTable dtNodeSets, string strParentColumn, string strRootValue, string strIndexColumn, string strTextColumn, DropDownList drpBind, int i)
        {
            //每向下一层,多一个缩入单位
            i++;

            DataView dvNodeSets = new DataView(dtNodeSets);
            dvNodeSets.RowFilter = strParentColumn + "=" + strRootValue;

            string strPading = "";  //缩入字符

            //通过i来控制缩入字符的长度,我这里设定的是一个全角的空格
            for (int j = 0; j < i; j++)
                strPading += " ";//如果要增加缩入的长度,改成两个全角的空格就可以了

            foreach (DataRowView drv in dvNodeSets)
            {
                TreeNode tnNode = new TreeNode();
                ListItem li = new ListItem(strPading + "├" + drv[strTextColumn].ToString(), drv[strIndexColumn].ToString());
                drpBind.Items.Add(li);
                MakeTree(dtNodeSets, strParentColumn, drv[strIndexColumn].ToString(), strIndexColumn, strTextColumn, drpBind, i);
            }

            //递归结束,要回到上一层,所以缩入量减少一个单位
            i--;
        }
Пример #20
0
 protected void btnAddNode_Click(object sender, EventArgs e)
 {
     TreeNode myNode = new TreeNode();
     myNode.Text = txbText.Text;
     myNode.NavigateUrl = txbUrl.Text;
     TreeView1.FindNode("Home/Finance/Markets").ChildNodes.Add(myNode);
 }
Пример #21
0
    private bool HasSelectableChild(TreeNode ParentNode)
    {
        if (ParentNode.ChildNodes.Count == 0)
        {
            return(((RelatedPage_Tree_CustomTreeNode)ParentNode).PossiblySelectable);
        }
        else
        {
            bool            SelectableChildFound = false;
            List <TreeNode> ChildrenToRemove     = new List <TreeNode>();

            foreach (TreeNode Child in ParentNode.ChildNodes)
            {
                if (!HasSelectableChild(Child))
                {
                    ChildrenToRemove.Add(Child);
                }
                else
                {
                    SelectableChildFound = true;
                }
            }
            // Remove children with no selections
            ChildrenToRemove.ForEach(x => ParentNode.ChildNodes.Remove(x));

            return(SelectableChildFound || ((RelatedPage_Tree_CustomTreeNode)ParentNode).PossiblySelectable);
        }
    }
Пример #22
0
    /// <summary>
    /// Adds node to the root node.
    /// </summary>
    /// <param name="nodeName">Name of node</param>
    /// <param name="forumId">ID of forum</param>
    private void AddNode(string nodeName, int forumId)
    {
        TreeElemNode newNode  = new TreeElemNode();
        string       cssClass = "ContentTreeItem";
        string       elemId   = string.Empty;

        // Select proper node
        if ((!selectedSet) && String.IsNullOrEmpty(selectedNodeName))
        {
            if (!RequestHelper.IsPostBack())
            {
                hdnForumId.Value = forumId.ToString();
            }
            ltlScript.Text += ScriptHelper.GetScript("parent.frames['main'].location.href = '" + navUrl + "&forumid=" + forumId + "'");
            selectedSet     = true;
            cssClass        = "ContentTreeSelectedItem";
            elemId          = "id=\"treeSelectedNode\"";
        }
        if (selectedNodeName == nodeName)
        {
            cssClass = "ContentTreeSelectedItem";
            elemId   = "id=\"treeSelectedNode\"";
        }
        newNode.Text        = "<span class=\"" + cssClass + "\" " + elemId + " onclick=\"SelectForumNode(" + ScriptHelper.GetString(nodeName) + ", this, " + forumId + ");\"><span class=\"Name\">" + HTMLHelper.HTMLEncode(nodeName) + "</span></span>";
        newNode.NavigateUrl = "#";

        treeElem.Nodes[0].ChildNodes.Add(newNode);
    }
Пример #23
0
		private void CreateMaschinenAuswertung (XmlDocument AuszaehlungsStand, TreeView AuszaehlungsTreeView)
			{
			TreeNode MaschinenRootNode = new TreeNode ("Abgegebene Stimmen pro Maschine");
			AuszaehlungsTreeView.Nodes.Add (MaschinenRootNode);
			XmlNode SprengelDatenNode = AuszaehlungsStand.DocumentElement.SelectSingleNode("child::" + MBRStatics.MBR_SPRENGEL_DATEN);
			XmlNode AltErlaaRootNode = SprengelDatenNode.LastChild;
			String MStiege = AltErlaaRootNode.Attributes[MBRStatics.MBR_STIEGE].Value;
			String MWohnungen = AltErlaaRootNode.SelectSingleNode("child::" + MBRStatics.MBR_WOHNUNGEN).InnerText;
			String MSchluessel = AltErlaaRootNode.SelectSingleNode("child::" + MBRStatics.MBR_SCHLUESSEL).InnerText;
			XmlNode MAbgegebenNode = AltErlaaRootNode.LastChild;
			foreach (XmlNode ZeitRaumNode in MAbgegebenNode.SelectNodes("child::" + MBRStatics.MBR_IM_ZEITRAUM))
				{
				String Von = ZeitRaumNode.Attributes[MBRStatics.MBR_VON].Value.Substring(5);
				String Bis = ZeitRaumNode.Attributes[MBRStatics.MBR_BIS].Value.Substring(5);
				TreeNode TreeZeitraumNode = new TreeNode ();
				if (ZeitRaumNode != MAbgegebenNode.LastChild)
					TreeZeitraumNode.Text = "Vom " + Von + " bis " + Bis;
				else
					TreeZeitraumNode.Text = "Insgesamt bis jetzt";
				MaschinenRootNode.ChildNodes.Add (TreeZeitraumNode);
				foreach (XmlNode Maschine in ZeitRaumNode.ChildNodes)
					{
					TreeNode MaschinenNode = new TreeNode (Maschine.InnerText + "   " + Maschine.Name);
					TreeZeitraumNode.ChildNodes.Add (MaschinenNode);
					}
				}
			}
Пример #24
0
        /// <summary>
        /// 绑定 Treeview Controls
        /// </summary>
        void BindGrid()
        {
            this.TVWMenu.Nodes.Clear();

            DataSet dsParent = new DataSet();
            dsParent.ReadXml(Server.MapPath("~/XMLMenu/RootMenu.xml"));
            DataSet dsChild = new DataSet();
            dsChild.ReadXml(Server.MapPath("~/XMLMenu/SubMenu.xml"));

            DataTable dtbl = dsParent.Tables[0];

            foreach (DataRow drow in dtbl.Rows)
            {
                TreeNode node = new TreeNode();

                node.Text = drow["Name"].ToString();
                node.Value = drow["ID"].ToString();

                AddTree(dsChild, drow["ID"].ToString(), node);

                this.TVWMenu.Nodes.Add(node);
            }

            this.TVWMenu.ExpandAll();
        }
    protected void treeElem_RootNodeCreated(object sender, EventArgs e)
    {
        // Add "Unassigned products" node when global products or products without document allowed
        if (AllowGlobalObjects || AllowProductsWithoutDocuments)
        {
            UITreeView treeControl = sender as UITreeView;
            if (treeControl != null)
            {
                System.Web.UI.WebControls.TreeNode newNode = new System.Web.UI.WebControls.TreeNode();

                // Set the base data
                newNode.Value = "-1";
                newNode.NavigateUrl = "javascript:void(0);";

                // Prepare name
                string nodeName = HttpUtility.HtmlEncode(GetString("com.productstree.unassigned"));
                string nodeNameJava = ScriptHelper.GetString(nodeName);

                newNode.Text = treeElem.NodeTextTemplate.Replace("##NODEID##", "-1").Replace("##NODENAMEJAVA##", nodeNameJava).Replace("##NODENAME##", nodeName).Replace("##ICON##", UIHelper.GetAccessibleIconTag("icon-box", GetString("com.productstree.unassignedtooltip"))).Replace("##STATUSICONS##", "");

                // Insert node to the top of tree
                treeControl.Nodes.AddAt(0, newNode);
            }
        }
    }
Пример #26
0
        /// <summary>
        /// 绑定报表功能菜单树
        /// </summary>
        public void BindReportTreeData()
        {
            tvReport.Nodes.Clear();
            DataTable dtReportCategory = WebReportCategoryBLL.Instance.GetAll();
            List<TreeNode> nodes = WebReportCategory.WebReportCategoryTree.GetTree(dtReportCategory);
            TreeNode root = new TreeNode();
            root.Text = "报表功能菜单树";
            root.Value = "0";

            var listReportInfo = WebReportInfoBLL.Instance.GetAllList("DELETED = 0 and STATUS=1", "CATEGORYID");
            int? categoryID = -1;
            TreeNode findNode = null;
            foreach (var item in listReportInfo)
            {
                if (categoryID != item.CATEGORYID)
                {
                    findNode = TreeNodeHelper.GetNodeByID(nodes, "" + item.CATEGORYID);
                }
                if (findNode != null)
                {
                    TreeNode childeNode = new TreeNode();
                    childeNode.Value = "Info_" + item.ID; //加Info_前缀的目的是防止ID和类别的ID相同
                    childeNode.Text = "" + item.NAME;
                    findNode.ChildNodes.Add(childeNode);

                    categoryID = item.CATEGORYID;
                }
            }

            foreach (TreeNode node in nodes)
            {
                root.ChildNodes.Add(node);
            }
            tvReport.Nodes.Add(root);
        }
 public void AddAt(int index, TreeNode child)
 {
     if (child == null)
     {
         throw new ArgumentNullException("child");
     }
     if (this._updateParent)
     {
         if ((child.Owner != null) && (child.Parent == null))
         {
             child.Owner.Nodes.Remove(child);
         }
         if (child.Parent != null)
         {
             child.Parent.ChildNodes.Remove(child);
         }
         if (this._owner != null)
         {
             child.SetParent(this._owner);
             child.SetOwner(this._owner.Owner);
         }
     }
     this._list.Insert(index, child);
     this._version++;
     if (this._isTrackingViewState)
     {
         ((IStateManager) child).TrackViewState();
         child.SetDirty();
     }
     this.Log.Add(new LogItem(LogItemType.Insert, index, this._isTrackingViewState));
 }
        private void PrepareTree()
        {
            // prepare tree
            tree.CollapseImageUrl = PortalUtils.GetThemedImage("min.gif");
            tree.ExpandImageUrl = PortalUtils.GetThemedImage("max.gif");
            tree.NoExpandImageUrl = PortalUtils.GetThemedImage("empty.gif");
            tree.Nodes.Clear();

            TreeNode rootNode = new TreeNode();
            rootNode.ImageUrl = PortalUtils.GetThemedImage("folder.png");
            rootNode.Text = GetLocalizedString("Text.Resources");
            rootNode.Value = "Root";
            rootNode.Expanded = true;
            tree.Nodes.Add(rootNode);

            // populate root node
            ServiceProviderItemType[] types = ES.Services.Import.GetImportableItemTypes(PanelSecurity.PackageId);
            foreach (ServiceProviderItemType type in types)
            {
                TreeNode node = new TreeNode();
                node.Value = "-" + type.ItemTypeId.ToString();
                node.Text = GetSharedLocalizedString("ServiceItemType." + type.DisplayName);
                node.PopulateOnDemand = true;
                node.ImageUrl = PortalUtils.GetThemedImage("folder.png");
                rootNode.ChildNodes.Add(node);
            }
        }
Пример #29
0
        protected void LoadFolderNodes(SPFolder folder, TreeNode folderNode)
        {
            foreach (SPFolder childFolder in folder.SubFolders)
            {
                TreeNode childFolderNode = new TreeNode(childFolder.Name, childFolder.Name, FOLDER_IMG);
                childFolderNode.NavigateUrl = SPContext.Current.Site.MakeFullUrl(childFolder.Url);
                LoadFolderNodes(childFolder, childFolderNode);
                folderNode.ChildNodes.Add(childFolderNode);
            }

            foreach (SPFile file in folder.Files)
            {
                TreeNode fileNode;
                if (file.CustomizedPageStatus == SPCustomizedPageStatus.Uncustomized)
                {
                    fileNode = new TreeNode(file.Name, file.Name, GHOSTED_FILE_IMG);
                }
                else
                {
                    fileNode = new TreeNode(file.Name, file.Name, UNGHOSTED_FILE_IMG);
                }

                fileNode.NavigateUrl = SPContext.Current.Site.MakeFullUrl(file.Url);
                folderNode.ChildNodes.Add(fileNode);
            }
        }
Пример #30
0
 protected string buildBreadcrumbs(TreeNode startingNode)
 {
     if (startingNode == null)
         return "<span class=\"breadCrumLabel\">Path</span>";
     string internalValuePath = (string)startingNode.GetType().InvokeMember("InternalValuePath", System.Reflection.BindingFlags.Default | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, startingNode, null);
     string postBackUrl = this.Page.ClientScript.GetPostBackClientHyperlink(this.tv, "s" + internalValuePath, true);
     string breadcrumSeparatorImageUrl = this.getImageUrl("breadcrumseparator.gif");
     string separator = String.Format("<span class=\"breadCrumSeparator\">&nbsp;<img src=\"{0}\" alt=\">>\" title=\">>\" /> &nbsp;</span>", breadcrumSeparatorImageUrl);
     string nodeText = startingNode.Parent != null ? startingNode.Text : "Storage";
     string breadCrum;
     if (startingNode == this.tv.SelectedNode)
     {
         string template = "<span class=\"breadCrumLast\" title=\"{1}\"><img src=\"{0}\" alt=\"{1}\" title=\"{1}\" />&nbsp;{2}</span>&nbsp;";
         breadCrum = String.Format(template, startingNode.ImageUrl, Utility.QuoteJScriptString(startingNode.ToolTip, false), Utility.QuoteJScriptString(nodeText, false));
     }
     else
     {
         string template = "<a href=\"{0}\" title=\"{1}\" class=\"breadCrum\"><img src=\"{2}\" alt=\"{3}\" title=\"{3}\" />&nbsp;{4}</a>&nbsp;";
         breadCrum = String.Format(template, postBackUrl, Utility.QuoteJScriptString(startingNode.ToolTip, false), startingNode.ImageUrl, Utility.QuoteJScriptString(startingNode.ToolTip, false), Utility.QuoteJScriptString(nodeText, false));
     }
     string result = this.buildBreadcrumbs(startingNode.Parent) + separator + breadCrum;
     if (result.StartsWith(separator))
         result = result.Substring(separator.Length);
     return result;
 }
Пример #31
0
        private void WriteNodeCheckbox(TreeView treeView, System.Web.UI.WebControls.TreeNode item, HtmlTextWriter writer)
        {
            writer.WriteBeginTag("input");
            writer.WriteAttribute("type", "checkbox");
            writer.WriteAttribute("id", treeView.ClientID + "n" + _checkboxIndex.ToString() + "CheckBox");
            writer.WriteAttribute("name", treeView.UniqueID + "n" + _checkboxIndex.ToString() + "CheckBox");

            if (!string.IsNullOrEmpty(treeView.Attributes["OnClientClickedCheckbox"]))
            {
                writer.WriteAttribute("onclick", treeView.Attributes["OnClientClickedCheckbox"]);
            }

            if (item.Checked)
            {
                writer.WriteAttribute("checked", "checked");
            }
            writer.Write(HtmlTextWriter.SelfClosingTagEnd);

            if (!string.IsNullOrEmpty(item.Text))
            {
                writer.WriteLine();
                writer.WriteBeginTag("label");
                writer.WriteAttribute("for", treeView.ClientID + "n" + _checkboxIndex.ToString() + "CheckBox");
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Write(item.Text);
                writer.WriteEndTag("label");
            }

            _checkboxIndex++;
        }
Пример #32
0
		private void ShowSelectionTree ()
			{
			
			TreeView SelectionTreeView = new TreeView ();
			SelectionTreeView.CssClass = "CSS_SelectionTreeView";
			this.ContentPlaceHolderNavigationPlace.Controls.Add (SelectionTreeView);
			LoadPossibleValues ();
			TreeNode StartNode = new TreeNode ("Kalender Durchsuchen nach..");
			StartNode.SelectAction = TreeNodeSelectAction.Expand;
			SelectionTreeView.Nodes.Add (StartNode);
			foreach (DataTable Table in PossibleValues.Tables)
				{
				String TableName = Table.TableName;
				String ColumnName = Table.Columns [0].ColumnName;
				TreeNode TableNode = new TreeNode (ColumnName);
				TableNode.SelectAction = TreeNodeSelectAction.Expand;
				StartNode.ChildNodes.Add (TableNode);
				foreach (DataRow TableRow in Table.Rows)
					{
					String Entry = TableRow [0].ToString ();
					TreeNode ContentNode = new TreeNode (Entry);
					TableNode.ChildNodes.Add (ContentNode);
					ContentNode.NavigateUrl = "./WPMediaCalendarDisplay.aspx?Search=Future&Table=Kalender"
						+ "&Column=" + ColumnName + "&Entry=" + Entry;
					}
				TableNode.Collapse ();
				}
			}
Пример #33
0
        private void BuildItem(System.Web.UI.WebControls.TreeNode item, HtmlTextWriter writer)
        {
            TreeView treeView = this;

            if ((treeView != null) && (item != null) && (writer != null))
            {
                writer.WriteLine();
                writer.WriteBeginTag("li");
                if (item.Selected || IsChildNodeSelected(item.ChildNodes))
                {
                    writer.WriteAttribute("class", "open");
                }
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;
                writer.WriteLine();

                if (!string.IsNullOrEmpty(item.NavigateUrl))
                {
                    WriteNodeLink(treeView, item, writer);
                }
                else
                {
                    WriteNodePlain(treeView, item, writer);
                }

                if (HasChildren(item))
                {
                    BuildItems(item.ChildNodes, false, item.Expanded.Equals(true), writer);
                }

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("li");
            }
        }
Пример #34
0
    /// <summary>
    /// Adds node to parent node.
    /// </summary>
    /// <param name="parentNode">Parent node</param>
    /// <param name="nodeName">Name of node</param>
    /// <param name="nodeType">Type of node</param>
    private void AddNode(TreeElemNode parentNode, string nodeName, string nodeType)
    {
        TreeElemNode newNode  = new TreeElemNode();
        string       cssClass = "ContentTreeItem";
        string       elemId   = string.Empty;

        // Select proper node
        if (selectedNodeName == nodeName)
        {
            if (webpartsTree.Nodes.Count > 0)
            {
                webpartsTree.Nodes[0].Text = webpartsTree.Nodes[0].Text.Replace("ContentTreeSelectedItem", "ContentTreeItem").Replace("treeSelectedNode", string.Empty);
            }
            else if (regionsTree.Nodes.Count > 0)
            {
                regionsTree.Nodes[0].Text = regionsTree.Nodes[0].Text.Replace("ContentTreeSelectedItem", "ContentTreeItem").Replace("treeSelectedNode", string.Empty);
            }
            if (nodeType == selectedNodeType)
            {
                cssClass = "ContentTreeSelectedItem";
                elemId   = "id=\"treeSelectedNode\"";
            }
        }
        newNode.Text        = "<span class=\"" + cssClass + "\" " + elemId + " onclick=\"SelectNode(" + ScriptHelper.GetString(nodeName) + ", " + ScriptHelper.GetString(nodeType) + ", this);\"><span class=\"Name\">" + HTMLHelper.HTMLEncode(nodeName) + "</span></span>";
        newNode.NavigateUrl = "#";
        parentNode.ChildNodes.Add(newNode);
    }
Пример #35
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // SECTION 1. Create a DOM Document and load the XML data into it.
                XmlDocument dom = new XmlDocument();
                dom.Load(Server.MapPath("~/data/Leffat.xml"));

                // SECTION 2. Initialize the TreeView control.
                treeView1.Nodes.Clear();
                treeView1.Nodes.Add(new TreeNode(dom.DocumentElement.Name));
                TreeNode tNode = new TreeNode();
                tNode = treeView1.Nodes[0];

                // SECTION 3. Populate the TreeView with the DOM nodes.
                AddNode(dom.DocumentElement, tNode);
                treeView1.CollapseAll();
            }
            catch (XmlException xmlEx)
            {
               Errors.InnerHtml= xmlEx.Message;
            }
            catch (Exception ex)
            {
                Errors.InnerHtml = ex.Message;
            }
        }
Пример #36
0
		private void CreateSprengelAuswertung (XmlDocument AuszaehlungsStand, TreeView AuszaehlungsTreeView)
			{

			TreeNode StiegenRootNode = new TreeNode ("Abgegebene Stimmen pro Stiege");
			AuszaehlungsTreeView.Nodes.Add (StiegenRootNode);
			XmlNode SprengelContainer = AuszaehlungsStand.DocumentElement.SelectSingleNode
				("child::" + MBRStatics.MBR_SPRENGEL_DATEN);

			foreach (XmlNode StiegenNode in SprengelContainer.SelectNodes("child::" + MBRStatics.MBR_SPRENGEL))
				{
				String Stiege = StiegenNode.Attributes[MBRStatics.MBR_STIEGE].Value.Replace("_", "/");
				String Wohnungen = StiegenNode.SelectSingleNode("child::" + MBRStatics.MBR_WOHNUNGEN).InnerText;
				String Schluessel = StiegenNode.SelectSingleNode("child::" + MBRStatics.MBR_SCHLUESSEL).InnerText;
				XmlNode AbgegebenNode = StiegenNode.LastChild;
				XmlNode ImZeitRaumNode = AbgegebenNode.LastChild;
				if (ImZeitRaumNode == null)
					continue;
				XmlNode AlleNode = ImZeitRaumNode.LastChild;
				String Abgegeben = AlleNode.InnerText;
				TreeNode StiegenTreeNode = new TreeNode (Stiege + " - " + Wohnungen
								+ "(" + Schluessel + ") "
								+ Abgegeben + "    Stimmen bisher abgegeben");
				StiegenRootNode.ChildNodes.Add (StiegenTreeNode);
				if (ImZeitRaumNode != null)
					foreach (XmlNode Maschine in ImZeitRaumNode.ChildNodes)
						{
						TreeNode MaschinenNode = new TreeNode (Maschine.InnerText + "   " + Maschine.Name);
						StiegenTreeNode.ChildNodes.Add (MaschinenNode);

						}
				}

			}
Пример #37
0
 private void InitTreeNode(TreeNodeCollection Nds, string UpDir)
 {
     string AbsPath = this.AppPath + UpDir + "/";
     AbsPath = AbsPath.Replace("/", @"\");
     AbsPath = AbsPath.Replace(@"\\", @"\");
     TreeNode tmpNd;
     string search = "UploadFile.aspx?Dir=";
     DataTable dt = FileSystemObject.GetDirectoryInfos(AbsPath, FsoMethod.Folder);
     foreach (DataRow dr in dt.Rows)
     {
         tmpNd = new TreeNode();
         string objPath=UpDir+"/"+dr["Name"].ToString();
         tmpNd.Value = dr["Name"].ToString();
         tmpNd.Text = dr["Name"].ToString();
         tmpNd.NavigateUrl = search + base.Server.UrlEncode(objPath);
         tmpNd.Target = "main_right";
         Nds.Add(tmpNd);
         string NextDir=UpDir+"/"+tmpNd.Value;
         string aPath = this.AppPath + NextDir + "/";
         aPath = aPath.Replace("/", @"\");
         aPath = aPath.Replace(@"\\", @"\");
         if (FileSystemObject.GetDirectoryInfos(aPath, FsoMethod.Folder).Rows.Count > 0)
         {
             InitTreeNode(tmpNd.ChildNodes, NextDir);
         }
     }
 }
        private void GetTreeViewItems()
        {
            string cs = ConfigurationManager.ConnectionStrings["constring"].ConnectionString;
            SqlConnection con = new SqlConnection(cs);
            SqlDataAdapter adapter = new SqlDataAdapter("usp_AllColumsOfCreateCustomers", con);
            DataSet ds = new DataSet();
            adapter.Fill(ds);
         
            
            //ds.Relations.Add("ChildRows", ds.Tables[0].Columns["AccountId"], ds.Tables[0].Columns["ParentId"]);
            ds.Relations.Add("ChildRows", ds.Tables[0].Columns["ChartOfAccountsId"], ds.Tables[0].Columns["ParentId"]);            
            foreach (DataRow Level1DataRow in ds.Tables[0].Rows)
            {
                if (string.IsNullOrEmpty(Level1DataRow["ParentId"].ToString()))
                {
                    TreeNode parentTreeNode = new TreeNode();
                    parentTreeNode.Text = Level1DataRow["Name"].ToString();
                   // parentTreeNode.NavigateUrl = Level1DataRow["NavigateUrl"].ToString();
                    getChildRows(Level1DataRow, parentTreeNode);
                    TreeView1.Nodes.Add(parentTreeNode);
                }
                //else if ((Level1DataRow["ParentId"].ToString()==13.ToString()))
                //{
                //    TreeNode parentTreeNode = new TreeNode();
                //    parentTreeNode.Text = Level1DataRow["AccountName"].ToString();
                //    parentTreeNode.NavigateUrl = Level1DataRow["NavigateUrl"].ToString();
                //    getChildRows(Level1DataRow, parentTreeNode);
                //    TreeView1.Nodes.Add(parentTreeNode);
                //}
            }


        }
Пример #39
0
        /// <summary>
        /// 绑定部门
        /// </summary>
        private void BindTreeView()
        {
            DataSet ds = mDpt.GetList(" ");
            DataTable dt = new DataTable();
            dt = ds.Tables[0];
            DataRow[] drs = dt.Select(" Dpt_ParentId = 0");  //选出所有根节点
            this.tvDaiLi.Nodes.Clear();
            TreeNode RootNode = new TreeNode();
            RootNode.Text = "<a href='SystemConfigMain.aspx?DPTId=0' onclick='aClick(this);' target='center' >组织机构</a>";
            RootNode.Value = "0";
            this.tvDaiLi.Nodes.Add(RootNode);
            foreach (DataRow dr in drs)
            {
                string DPTId = dr["Dpt_Id"].ToString();
                string DPTName = dr["Dpt_Name"].ToString();
                string DPTPARENTID = dr["Dpt_ParentId"].ToString();

                TreeNode RootNode2 = new TreeNode();
                RootNode2.Text = "<a href='SystemConfigMain.aspx?DPTId=" + DPTId + "' onclick='aClick(this);' target='center' >" + DPTName + "</a>";
                RootNode2.Value = DPTId;
                RootNode.ChildNodes.Add(RootNode2);
                string SonParentID = DPTId;
                CreateNode(SonParentID, RootNode2, dt);
            }
            //this.tvDaiLi.CollapseAll();
        }
Пример #40
0
 protected void treeMenu_TreeNodePopulate(object sender, TreeNodeEventArgs e)
 {
     string userID = userEntity.UserID;
     try
     {
         DataView dv = new DataView();
         string parentId = e.Node.Value.ToString();
         dv.Table = ProductTypeDataTable.Copy();
         dv.RowFilter = "PSSMEPMC='" + parentId + "' and PSSMEUS='1'";
         foreach (DataRowView drv in dv)
         {
             TreeNode node = new TreeNode();
             node.Text = drv["PSSMEMN"].ToString();
             node.Value = drv["PSSMEMC"].ToString();
             node.PopulateOnDemand = true;
             node.SelectAction = TreeNodeSelectAction.Expand;
             node.NavigateUrl = drv["PSSMEMP"].ToString();
             node.Target = drv["PSSMEOWT"].ToString();
             e.Node.ChildNodes.Add(node);
         }
     }
     catch
     {
     }
 }
Пример #41
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {

                var files = Services.Files.AllVirtual("~/*.aspx;~/*.ascx;~/*.master;~/*.asmx;~/*.ashx;~/*.html;");

                var results = files
                    .Select(name => new { Name = name, Html = Services.Files.LoadVirtual(name), Doc = Html.Document.Open(name) })
                    .Where(d => d.Doc != null)
                    .Select(f => new { Name = f.Name, Html = f.Html, Doc = f.Doc, Errors = f.Doc.Errors, Match = f.Html == f.Doc.Text });

                tree.Nodes.Clear();
                foreach (var res in results) {
                    var node = new TreeNode();
                    node.Text = res.Name +
                        (res.Match ? " matches" : " <span style='color:red'>mismatch</span>") +
                        ((res.Errors.Count > 0) ? " <span style='color:red'>has errors</span>." : " no errors.");
                    node.NavigateUrl = "~/Silversite/Test/htmlparser.aspx?page=" + res.Name;

                    foreach (var err in res.Errors) {
                        var errnode = new TreeNode();
                        errnode.Text = "<span style='color:red'>" + err + "</span>";
                        node.ChildNodes.Add(errnode);
                    }
                    tree.Nodes.Add(node);
                }

            }
        }
Пример #42
0
    /// <summary>
    /// Adds node to the root node.
    /// </summary>
    /// <param name="nodeName">Name of node</param>
    /// <param name="boardId">Message board identifier</param>
    private void AddNode(string nodeName, int boardId, bool group)
    {
        TreeElemNode newNode = new TreeElemNode();
        string cssClass = "ContentTreeItem";
        string elemId = string.Empty;

        string url = group ? groupNavUrl : navUrl;

        // Select proper node
        if ((!selectedSet) && String.IsNullOrEmpty(selectedNodeName))
        {
            if (!RequestHelper.IsPostBack())
            {
                hdnBoardId.Value = boardId.ToString();
            }
            ltlScript.Text += ScriptHelper.GetScript("parent.frames['main'].location.href = '" + url + "&boardid=" + boardId + "'");
            selectedSet = true;
            cssClass = "ContentTreeSelectedItem";
            elemId = "id=\"treeSelectedNode\"";
        }
        if (selectedNodeName == nodeName)
        {
            cssClass = "ContentTreeSelectedItem";
            elemId = "id=\"treeSelectedNode\"";
        }

        newNode.Text = "<span class=\"" + cssClass + "\" " + elemId + " onclick=\"SelectNode(" + ScriptHelper.GetString(HttpUtility.UrlEncode(nodeName)) + ", this, " + boardId + ", '" + url + "');\"><span class=\"Name\">" + HTMLHelper.HTMLEncode(nodeName) + "</span></span>";
        newNode.ImageUrl = GetImageUrl("Objects/Board_Board/list.png");
        newNode.NavigateUrl = "#";

        treeElem.Nodes[0].ChildNodes.Add(newNode);

        return;
    }
Пример #43
0
    /// <summary>
    /// Node populating.
    /// </summary>
    /// <param name="sender">Sender</param>
    /// <param name="e">Particular node arguments</param>
    protected void treeFileSystem_TreeNodePopulate(object sender, TreeNodeEventArgs e)
    {
        e.Node.ChildNodes.Clear();
        e.Node.PopulateOnDemand = false;

        try
        {
            DirectoryInfo dirInfo;
            dirInfo = DirectoryInfo.New(e.Node.Value);

            DirectoryInfo[] childDirs = dirInfo.GetDirectories();

            for (int i = 0, index = 0; i < childDirs.Length; i++)
            {
                System.Web.UI.WebControls.TreeNode newNode = CreateNode(childDirs[i], index);
                if (newNode != null)
                {
                    e.Node.ChildNodes.Add(newNode);
                    // More content node was inserted
                    if (newNode.Value == "")
                    {
                        i--;
                    }
                    index++;
                }
            }
        }
        catch
        {
        }
    }
Пример #44
0
    /// <summary>
    /// Appends given child object to the root node.
    /// </summary>
    /// <param name="root">Root node</param>
    /// <param name="colName">Name of the column</param>
    /// <param name="childObj">Child object to append</param>
    /// <param name="enumerate">Indicates if it's enumeration item</param>
    /// <param name="isPriorityTree">If true, nodes are appended to a priority tree</param>
    private void AppendChild(TreeNode root, string colName, object childObj, bool enumerate, bool isPriorityTree)
    {
        // Convert object property to value
        var objProp = childObj as ObjectProperty;

        if (objProp != null)
        {
            object value = objProp.Value;

            AppendChild(root, colName, value, enumerate, isPriorityTree);

            return;
        }

        // Skip page context macros
        if (ContextResolver.Settings.DisablePageContextMacros && ((colName.ToLowerCSafe() == "currentdocument") || (colName.ToLowerCSafe() == "currentpageinfo")))
        {
            return;
        }

        // Skip contexts
        if (ContextResolver.Settings.DisableContextObjectMacros && colName.EndsWithCSafe("context", true))
        {
            return;
        }

        bool isSimple = IsSimpleValue(childObj);

        // Append JS onclick action if defined, pass macro expression to the handler
        string jsHandler = "";

        if (!string.IsNullOrEmpty(OnNodeClickHandler))
        {
            string macroArg = root.ValuePath.Replace('/', '.') + (enumerate ? "[" + colName + "]" : "." + colName);
            macroArg = HttpUtility.UrlDecode(macroArg);
            macroArg = macroArg.Replace(".[", "[");

            if (!isPriorityTree)
            {
                macroArg = macroArg.Substring(MacroExpression.Length);
            }

            jsHandler = OnNodeClickHandler + "(" + ScriptHelper.GetString(macroArg.TrimStart('.'), true) + ");";
        }

        var name     = GetObjectName(colName, childObj, enumerate);
        var icon     = GetObjectIcon(childObj, colName);
        var iconHtml = GetIconHtml(name, icon, jsHandler);

        // Create the node
        TreeNode child = new TreeNode(iconHtml);

        child.ToolTip          = GetValueString(childObj, isSimple);
        child.Value            = HttpUtility.UrlEncode(enumerate ? "[" + colName + "]" : colName);
        child.PopulateOnDemand = !isSimple;
        child.Expanded         = false;

        root.ChildNodes.Add(child);
    }
Пример #45
0
 private string ToAbsolute(System.Web.UI.WebControls.TreeNode item)
 {
     if (item.NavigateUrl.StartsWith("~"))
     {
         return(VirtualPathUtility.ToAbsolute(item.NavigateUrl));
     }
     else
     {
         return(item.NavigateUrl);
     }
 }
Пример #46
0
 private void AddSubtreeForItem(HierarchyRow row, WC.TreeNode item)
 {
     HierarchyRow[] children = row.GetHierarchyChildRows("Hierarchy");
     WC.TreeNode    childItem;
     foreach (HierarchyRow child in children)
     {
         childItem = new WC.TreeNode((child.Caption ?? "NULL"), child["NavId"].ToString());
         item.ChildNodes.Add(childItem);
         AddSubtreeForItem(child, childItem);
     }
 }
Пример #47
0
        private void WriteNodePlain(TreeView treeView, System.Web.UI.WebControls.TreeNode item, HtmlTextWriter writer)
        {
            writer.WriteBeginTag("span");
            writer.Write(HtmlTextWriter.TagRightChar);

            WriteNodeImage(treeView, item, writer);
            writer.Write(item.Text);

            writer.Indent--;
            writer.WriteEndTag("span");
        }
Пример #48
0
 private void SetExpandedNode(List <string> ExpandedValues, TreeNode node)
 {
     if (ExpandedValues.Contains(node.Value))
     {
         node.Expanded = true;
     }
     foreach (TreeNode subNode in node.ChildNodes)
     {
         SetExpandedNode(ExpandedValues, subNode);
     }
 }
Пример #49
0
 private void CreateFirstLevelProperty(string NewPropery)
 {
     flag = 0;
     SearchForNode(this.TreeViewDisease.CheckedNodes, "Predisposition", "");
     if (flag != 1)
     {
         string TimeStr = DateTime.Now.ToShortTimeString();
         System.Web.UI.WebControls.TreeNode NewNode = new System.Web.UI.WebControls.TreeNode("Predispositions", TimeStr);
         this.TreeViewDisease.Nodes[0].ChildNodes.Add(NewNode);
     }
 }
Пример #50
0
 /// <summary>
 /// 查找根节点
 /// </summary>
 /// <param name="node">当前节点</param>
 /// <returns></returns>
 public TreeNode FindBootNode(System.Web.UI.WebControls.TreeNode node)
 {
     if (node == null)
     {
         return(null);
     }
     while (node.Parent != null)
     {
         node = node.Parent;
     }
     return(node);
 }
Пример #51
0
 /// <summary>
 /// 展开祖父节点
 /// </summary>
 /// <param name="node"></param>
 public void ExplandParentNode(System.Web.UI.WebControls.TreeNode node)
 {
     if (node == null)
     {
         return;
     }
     while (node.Parent != null)
     {
         node = node.Parent;
         node.Expand();
     }
 }
Пример #52
0
        private void WriteNodeImage(TreeView treeView, System.Web.UI.WebControls.TreeNode item, HtmlTextWriter writer)
        {
            string imgSrc = GetImageSrc(treeView, item);

            if (!string.IsNullOrEmpty(imgSrc))
            {
                writer.WriteBeginTag("img");
                writer.WriteAttribute("src", treeView.ResolveClientUrl(imgSrc));
                writer.WriteAttribute("alt", !string.IsNullOrEmpty(item.ToolTip) ? item.ToolTip : (!string.IsNullOrEmpty(treeView.ToolTip) ? treeView.ToolTip : item.Text));
                writer.Write(HtmlTextWriter.SelfClosingTagEnd);
            }
        }
Пример #53
0
    public static TreeNode Find(this System.Web.UI.WebControls.TreeNode node, string childValue)
    {
        foreach (TreeNode childNode in node.ChildNodes)
        {
            if (childNode.Value == childValue)
            {
                return(childNode);
            }
        }

        return(null);
    }
 private void LadoNorteNew(DataTable dtLadoNorte)
 {
     DataRow[] Rows = dtLadoNorte.Select("idSurco IS NULL"); // Get all parents nodes
     for (int i = 0; i < Rows.Length; i++)
     {
         System.Web.UI.WebControls.TreeNode root = new System.Web.UI.WebControls.TreeNode(Rows[i]["Seccion"].ToString(), Rows[i]["idSeccion"].ToString());
         root.SelectAction = TreeNodeSelectAction.Expand;
         root.Expand();
         CreateNode(root, dtLadoNorte);
         trPares.Nodes.Add(root);
     }
 }
Пример #55
0
    private void HideUnselectableChildren(TreeNode RootNode)
    {
        List <TreeNode> ChildrenToRemove = new List <TreeNode>();

        foreach (TreeNode Child in RootNode.ChildNodes)
        {
            if (!HasSelectableChild(Child))
            {
                ChildrenToRemove.Add(Child);
            }
        }
        ChildrenToRemove.ForEach(x => RootNode.ChildNodes.Remove(x));
    }
Пример #56
0
 private void SaveNodes(System.Web.UI.WebControls.TreeNodeCollection destNodes, System.Windows.Forms.TreeNodeCollection sourceNodes)
 {
     destNodes.Clear();
     foreach (TreeNodeContainer container in sourceNodes)
     {
         System.Web.UI.WebControls.TreeNode webTreeNode = container.WebTreeNode;
         destNodes.Add(webTreeNode);
         if (container.Nodes.Count > 0)
         {
             this.SaveNodes(webTreeNode.ChildNodes, container.Nodes);
         }
     }
 }
Пример #57
0
    private List <string> GetExpandedNodeValues(TreeNode node)
    {
        List <string> NodeValues = new List <string>();

        if (node.Expanded.HasValue && node.Expanded.Value)
        {
            NodeValues.Add(node.Value);
        }
        foreach (TreeNode subNode in node.ChildNodes)
        {
            NodeValues.AddRange(GetExpandedNodeValues(subNode));
        }
        return(NodeValues);
    }
Пример #58
0
    /// <summary>
    /// Appends the "more" node (for case when there is more items than max nodes
    /// </summary>
    /// <param name="root">Root node</param>
    private void AppendMore(TreeNode root)
    {
        string iconUrl = GetImagePath("Design/Controls/MacroEditor/info.png");;
        string icon    = "<img src=\"" + URLHelper.ResolveUrl(iconUrl) + "\" alt=\"\" style=\"border:0px;vertical-align:middle;\" class=\"Image16\" />";

        string text = "<span class=\"ContentTreeItem\" onclick=\"return false;\">" + icon + "<span class=\"Name\">" + GetString("MacroTree.More") + "</span></span>";

        TreeNode child = new TreeNode(text);

        child.ToolTip          = GetString("MacroTree.MoreInfo");
        child.Value            = "";
        child.PopulateOnDemand = false;

        root.ChildNodes.Add(child);
    }
 private void SetPossibleAndSelectedCategoriesTreeRecursive(TreeNode treeNode)
 {
     if (DisplayMode == DisplayType.List || treeNode.ChildNodes.Count == 0 || !OnlyLeafSelectable)
     {
         PossibleCategoryIDs.Add(ValidationHelper.GetInteger(treeNode.Value, -1));
         if (treeNode.Checked)
         {
             SelectedCategoryIDs.Add(ValidationHelper.GetInteger(treeNode.Value, -1));
         }
     }
     foreach (TreeNode childNode in treeNode.ChildNodes)
     {
         SetPossibleAndSelectedCategoriesTreeRecursive(childNode);
     }
 }
Пример #60
0
 /// <summary>
 /// Returns true if the node is site node.
 /// </summary>
 /// <param name="node">Node</param>
 public bool IsSiteNode(TreeNode node)
 {
     if ((node == null) || (node.Parent == null))
     {
         return(false);
     }
     else if (node.Value == "##SITE##")
     {
         return(true);
     }
     else
     {
         return(IsSiteNode(node.Parent));
     }
 }