Beispiel #1
0
        private void FillTreeView(Guid?SelectedMetricCategoryId, bool ClearText)
        {
            if (ClearText)
            {
                ddlMetricCategory.Text = string.Empty;
            }
            Telerik.Web.UI.RadTreeView tvMetricCategorys = (Telerik.Web.UI.RadTreeView)ddlMetricCategory.Items[0].FindControl("tvMetricCategorys");

            if (!IsFilled)
            {
                tvMetricCategorys.DataSource        = GetDataSource();
                tvMetricCategorys.DataTextField     = "Name";
                tvMetricCategorys.DataFieldParentID = "ParentId";
                tvMetricCategorys.DataValueField    = "MetricCategoryID";
                tvMetricCategorys.DataFieldID       = "MetricCategoryID";
                tvMetricCategorys.DataBind();
            }

            System.Collections.Generic.IList <Telerik.Web.UI.RadTreeNode> AllNodes = tvMetricCategorys.GetAllNodes();
            foreach (Telerik.Web.UI.RadTreeNode node in AllNodes)
            {
                string FullPath = node.Text;
                Telerik.Web.UI.RadTreeNode Parent = node;
                while ((Parent = Parent.ParentNode) != null)
                {
                    FullPath = Parent.Text + " > " + FullPath;
                }

                if (SelectedMetricCategoryId != null && SelectedMetricCategoryId != Guid.Empty && node.Value == SelectedMetricCategoryId.ToString())
                {
                    ddlMetricCategory.Text = FullPath;
                }
                node.Attributes.Add("FullPath", FullPath);

                node.ImageUrl = "~/images/GCATree/";
                switch (node.Level)
                {
                case 0:
                    node.ImageUrl += "group16.gif";
                    break;

                case 1:
                    node.ImageUrl += "category16.gif";
                    break;

                default:
                    node.ImageUrl += "aspect16.gif";
                    break;
                }
            }

            IsFilled = true;
        }
Beispiel #2
0
        private void FillTreeView(Guid?SelectedOrgLocationId, bool ClearText)
        {
            if (ShowNullAsRooOrgLocation && SelectedOrgLocationId == null)
            {
                SelectedOrgLocationId = Guid.Empty;
            }
            if (ClearText)
            {
                ddlOrgLocation.Text = string.Empty;
            }
            Telerik.Web.UI.RadTreeView tvOrgLocations = GetTvOrgLocations();

            if (!IsFilled)
            {
                tvOrgLocations.DataSource        = GetDataSource();
                tvOrgLocations.DataTextField     = "Name";
                tvOrgLocations.DataFieldParentID = "ParentEntityNodeId";
                tvOrgLocations.DataValueField    = "EntityNodeId";
                tvOrgLocations.DataFieldID       = "EntityNodeId";
                tvOrgLocations.DataBind();
            }

            System.Collections.Generic.IList <Telerik.Web.UI.RadTreeNode> AllNodes = tvOrgLocations.GetAllNodes();
            foreach (Telerik.Web.UI.RadTreeNode node in AllNodes)
            {
                string FullPath = node.Text;
                Telerik.Web.UI.RadTreeNode Parent = node;
                while ((Parent = Parent.ParentNode) != null)
                {
                    FullPath = Parent.Text + " > " + FullPath;
                }

                if (SelectedOrgLocationId != null && node.Value == SelectedOrgLocationId.ToString())
                {
                    ddlOrgLocation.Text = FullPath;
                }
                node.Attributes.Add("FullPath", FullPath);

                node.ImageUrl = "~/images/GCATree/OrgLocation.gif";
            }

            IsFilled = true;
        }