protected void AddSiteClick(object sender, EventArgs e) { string regionId = popAddSite.ReferrerId; string siteName = popAddSite.Value; // If this site name already exists, then error if (SiteManager.GetSiteByName(siteName) != null) { ((IFeedback)Page.Master).ShowFeedback(Feedback.Actions.Error, "Site " + siteName + " already exists"); } else { Region region = SiteManager.GetRegionById(regionId); Site site = new Site(); site.Name = siteName; site.Region = region; site.SiteType = SiteManager.GetAllSiteTypes().First(); SiteManager.CreateSite(site); this.PopulateTreeView <Region>(SiteManager.GetAllRegions(), true, false, string.Empty); RadTreeView1.DataBind(); RadTreeView1.FindNodeByText(region.Name).ExpandParentNodes(); RadTreeView1.FindNodeByText(region.Name).Selected = true; ((IFeedback)this.Page.Master).ShowFeedback( BusiBlocksConstants.Blocks.Administration.LongName, site.GetType().Name, Feedback.Actions.Created, site.Name ); } }
override protected Boolean LoadData() { try { if (ddlRGroup.Items.Count > 0) { Int32 iRGroup; iRGroup = Convert.ToInt32(ddlRGroup.SelectedValue); int UserID = int.Parse(MyConfig.GetValueByKey("UserID")); DataSet ds = new DataSet(); ds = tData.USP_WebFunction_GetListByGroupIDAndUserID(iRGroup, UserID); RadTreeView1.DataSource = ds; RadTreeView1.DataBind(); // } } catch (Exception ex) { ShowErrorMes("Lỗi hệ thống: " + ex.Message); } return(true); }
protected void AddRegionClick(object sender, EventArgs e) { Region newRegion = new Region(); newRegion.Name = popAddRegion.Value; newRegion.ParentRegion = SiteManager.GetRegionById(popAddRegion.ReferrerId); IList <RegionType> regionTypes = SiteManager.GetAllRegionTypes(); RegionType regionType = regionTypes.Last(); newRegion.RegionType = regionType; if (!SiteManager.IsRegionUnique(newRegion)) { ((IFeedback)this.Page.Master).SetError(GetType(), "The region is not unique within its parent region"); return; } SiteManager.CreateRegion(newRegion); PopulateTreeView <Region>(SiteManager.GetAllRegions(), true, false, string.Empty); RadTreeView1.DataBind(); RadTreeView1.FindNodeByText(newRegion.Name).ExpandParentNodes(); RadTreeView1.FindNodeByText(newRegion.ParentRegion.Name).Selected = true; ((IFeedback)this.Page.Master).ShowFeedback( BusiBlocksConstants.Blocks.Administration.LongName, newRegion.GetType().Name, Feedback.Actions.Created, newRegion.Name ); }
protected void CreateRegionNodeItems(Region region, string personId) { IList <Site> sites = SiteManager.GetAllSitesByRegion(region, false); string parentRegionName = region.Name; string parentRegionId = region.Id; foreach (Site site in sites) { RadTreeNode node = new RadTreeNode(site.Name, site.Id); node.ImageUrl = "../App_Themes/Default/icons/site.png"; Panel p = new Panel(); p.ID = "pnlNode"; p.CssClass = "tvNode"; Label lblName = new Label(); lblName.ID = "lblDivNodeName"; lblName.Text = site.Name + " "; Label lblContextMenu = new Label(); lblContextMenu.CssClass = site.Id + "_tvContext hideElement"; lblContextMenu.Text = "<a href=# onclick=\"addSites('" + personId + "','" + site.Id.ToString() + "','" + site.Name.ToString() + "','Site');\">" + "<img src='../App_Themes/Default/icons/add.png' />Add Site Access</a>"; p.Controls.Add(lblName); p.Controls.Add(lblContextMenu); node.Controls.Add(p); if (region != null) { RadTreeView1.FindNodeByValue(parentRegionId).Nodes.Add(node); } } }
private void AddNodes <T>(T node, bool isAdmin, bool showNodeItems, IList <T> userAdminList, string personId) { var t = typeof(T); var nodes = from items in userAdminList select items; if (t.FullName.Contains("Region")) { Region r = node as Region; IList <Region> userRegionList = userAdminList as IList <Region>; if (r.ParentRegion != null) { if (RadTreeView1.FindNodeByText(r.ParentRegion.Name) != null) { AddSubNode(r, isAdmin, showNodeItems, userRegionList, personId); } else { IList <Region> regions = new List <Region>(); foreach (var item in nodes) { regions.Add(item as Region); } if (regions.Contains(r.ParentRegion))//if sub node's parent not add parent nodes first!. { AddParentNode(r.ParentRegion, isAdmin, showNodeItems, userRegionList, personId); } //add the node again after adding parent nodes. AddSubNode(r, isAdmin, showNodeItems, userRegionList, personId); } } } }
private IList <SortStruct> Add0Levels(IList <SortStruct> sortList, bool isAdmin, bool showNodeItems) { IList <SortStruct> oLevels = new List <SortStruct>(); // An 0 level item is one whose parent is null, or who's parent is not in the sort list. foreach (SortStruct item in sortList) { if (string.IsNullOrEmpty(item.ParentId) || sortList.FirstOrDefault(x => x.Id.Equals(item.ParentId)) == null) { oLevels.Add(item); } } // Add 0levels to the tree view. foreach (SortStruct sortItem in oLevels) { Type originalType = sortItem.OriginalType; if (sortItem.OriginalType.FullName.Contains("News")) { BusiBlocks.CommsBlock.News.Category category = sortItem.Original as BusiBlocks.CommsBlock.News.Category; CreateCategoryNode(category, isAdmin); } else if (sortItem.OriginalType.FullName.Contains("Doco")) { BusiBlocks.DocoBlock.Category category = sortItem.Original as BusiBlocks.DocoBlock.Category; CreateCategoryNode(category, isAdmin); } } // Databind so that the children can find their parents in the tree view. RadTreeView1.DataBind(); return(oLevels); }
protected void LoadTree(string activeNode, bool expand) { if (CurrentEntity == null) { return; } var groupHierarchy = Sage.SalesLogix.Account.Helpers.GetAccountHierarchy(CurrentEntity); RadTreeView1.DataTextField = "Display"; RadTreeView1.DataValueField = "Id"; RadTreeView1.DataFieldID = "Id"; RadTreeView1.DataFieldParentID = "ParentId"; RadTreeView1.DataSource = groupHierarchy; RadTreeView1.DataBind(); if (expand) { RadTreeView1.ExpandAllNodes(); } if (!string.IsNullOrEmpty(activeNode)) { var radTreeNode = RadTreeView1.FindNodeByValue(activeNode); if (radTreeNode != null) { radTreeNode.Selected = true; } } }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="nodeType"></param> /// <param name="isAdmin"></param> /// <param name="showNodeItems"></param> /// <param name="userAdminList"></param> protected void AddParentNode <T>(T nodeType, bool isAdmin, bool showNodeItems, IList <T> userAdminList, string personId) { var tempNodeType = typeof(T); string nodeText = ""; string nodeID; var t = nodeType; List <T> temp = new List <T>(); // todo the following code is dodgey. The check for a parent needs to be handled better. switch (tempNodeType.Name) { case "Category": if (tempNodeType.FullName.Contains("News")) { if ((nodeType as BusiBlocks.CommsBlock.News.Category).ParentCategory == null) { return; } nodeText = (nodeType as BusiBlocks.CommsBlock.News.Category).ParentCategory.Name; BusiBlocks.CommsBlock.News.Category x = NewsManager.GetCategoryByName(nodeText, true); t = (T)Convert.ChangeType(x, typeof(T)); } else if (tempNodeType.FullName.Contains("Doco")) { if ((nodeType as BusiBlocks.DocoBlock.Category).ParentCategory == null) { return; } nodeText = (nodeType as BusiBlocks.DocoBlock.Category).ParentCategory.DisplayName; nodeID = (nodeType as BusiBlocks.DocoBlock.Category).ParentCategory.Id; BusiBlocks.DocoBlock.Category x = DocoManager.GetCategory(nodeID); t = (T)Convert.ChangeType(x, typeof(T)); } break; case "Region": nodeText = (nodeType as Region).ParentRegion.Name; break; default: break; } if (RadTreeView1.FindNodeByText(nodeText) != null) { AddSubNode(nodeType, isAdmin, showNodeItems, userAdminList, personId); } else { //Add the parent node that does not have a parent node to a list. temp.Add(nodeType); AddParentNode(t, isAdmin, showNodeItems, userAdminList, personId); foreach (T item in temp) { AddSubNode(item, isAdmin, showNodeItems, userAdminList, personId); } } }
private double CalculateTotalReceived(IAccount account) { double received = 0; foreach (var inv in account.ErpReceivables) { if (inv.GrandTotal.HasValue) { received += inv.GrandTotal.Value; } } if (chkCascade.Checked) { var node = RadTreeView1.FindNodeByValue(account.Id.ToString()); if (node != null && node.Nodes != null) { foreach (RadTreeNode kid in node.Nodes) { var childAccount = EntityFactory.GetById <IAccount>(kid.Value); if (childAccount != null) { received += CalculateTotalReceived(childAccount); } } } } return(received); }
private void LoadCategory() { DAProductCat daProductCat = new DAProductCat(); RadTreeView1.DataSource = daProductCat.USP_ProductCat_GetBelongDiscountID(this.KeyID); RadTreeView1.DataBind(); }
protected void DeleteRegionClick(object sender, EventArgs e) { string regionID = popDeleteRegion.ReferrerId; Region region = SiteManager.GetRegionById(regionID); Region parentRegion = region.ParentRegion; string regionName = region.Name; string regionTypeName = region.GetType().Name; IList <Site> sites = SiteManager.GetAllSitesByRegion(region, true); if (sites.Count == 0) { SiteManager.DeleteRegion(region); ((IFeedback)this.Page.Master).ShowFeedback( BusiBlocksConstants.Blocks.Administration.LongName, regionTypeName, Feedback.Actions.Deleted, regionName ); PopulateTreeView <Region>(SiteManager.GetAllRegions(), true, false, string.Empty); RadTreeView1.DataBind(); RadTreeView1.FindNodeByText(parentRegion.Name).Selected = true; } else { ((IFeedback)this.Page.Master).ShowFeedback( BusiBlocksConstants.Blocks.Administration.LongName, region.GetType().Name, Feedback.Actions.Error, ErrorRegionNotEmpty ); } }
public FlowTreeview() { InitializeComponent(); LoadTreeData(); RadTreeView1.AddHandler(RadMenuItem.ClickEvent, new RoutedEventHandler(OnMenuItemClicked)); LoadContentMenu(); }
protected void CreateRegionTreeView <T>(IList <T> regionDatasource, bool isAdmin, bool showNodeItems, string personId) { IList <Region> regions = (IList <Region>)regionDatasource; Person person = PersonManager.GetPersonByUserName(Page.User.Identity.Name); IList <Region> userRegions = PersonManager.GetAdminRegionsByPerson(person, true); bool isSuperAdmin = false; IList <PersonType> myGroups = PersonManager.GetPersonTypesByUser(Page.User.Identity.Name); if (myGroups.FirstOrDefault(x => x.Name.Equals(BusiBlocksConstants.AdministratorsGroup)) != null) { isSuperAdmin = true; userRegions = SiteManager.GetAllRegions(); } //add root node var rootNode = from x in regions where x.ParentRegion == null select x; IEnumerable <Region> rootNodes = rootNode; foreach (Region r in rootNodes) { if (isSuperAdmin == false) { if (userRegions.FirstOrDefault <Region>(x => x.Id.Equals(r.Id)) != null) { AddSubNode(r, isAdmin, showNodeItems, userRegions, personId); } } else { AddSubNode(r, isAdmin, showNodeItems, userRegions, personId); } } RadTreeView1.DataBind(); //add sub nodes var subNode = from x in regions where x.ParentRegion != null select x; IEnumerable <Region> subNodes = subNode; foreach (Region r in subNodes) { if (isSuperAdmin == false) { if (userRegions.FirstOrDefault <Region>(x => x.Id.Equals(r.Id)) != null) { AddNodes(r, isAdmin, showNodeItems, userRegions, personId); } } else { AddNodes(r, isAdmin, showNodeItems, userRegions, personId); } } }
protected void RadTreeView1_DataBound(object sender, EventArgs e) { if (_hId > 0) { RadTreeNode node = RadTreeView1.FindNodeByValue("" + _hId); node.Selected = true; node.Expanded = true; node.ExpandParentNodes(); } }
private void BindTreeToDirectory(string dirPath, RadTreeNode parentNode, string exfolder) { string[] directories = Directory.GetDirectories(dirPath); foreach (string directory in directories) { if (!Path.GetFileName(directory).Contains("_svn") && !Path.GetFileName(directory).Contains(".svn")) { RadTreeNode node = new RadTreeNode(Path.GetFileName(directory)); node.ImageUrl = "/admin/images/folder.gif"; node.ExpandedImageUrl = "/admin/images/folder.gif"; node.ContextMenuID = "MainContextMenu"; node.Category = "Folder"; node.Value = directory; parentNode.Nodes.Add(node); BindTreeToDirectory(directory, node, exfolder); } } string[] files = Directory.GetFiles(dirPath); foreach (string file in files) { if (!Path.GetFileName(file).Contains("_svn") && !Path.GetFileName(file).Contains(".svn")) { RadTreeNode node = new RadTreeNode(Path.GetFileName(file)); node.ContextMenuID = "ContextMenuFiles"; node.Category = "Files"; node.Value = file; node.ImageUrl = "/admin/images/" + GetImageForExtension(Path.GetFileName(file).Substring(Path.GetFileName(file).IndexOf("."))); node.ExpandedImageUrl = "/admin/images/" + GetImageForExtension(Path.GetFileName(file).Substring(Path.GetFileName(file).IndexOf("."))); parentNode.Nodes.Add(node); } } if (exfolder != "") { if (exfolder == dirPath) { //string dir = exfolder.Substring(0, exfolder.LastIndexOf("\\")); foreach (RadTreeNode node in RadTreeView1.GetAllNodes()) { if (node.Value == exfolder) { node.ExpandParentNodes(); node.Selected = true; node.Expanded = true; } } //RadTreeNode cachedNodeClicked = RadTreeView1.FindNodeByValue(exfolder); //cachedNodeClicked.Expanded = true; //cachedNodeClicked.Selected = true; } } }
public void BindTree() { ProductManager manager = new ProductManager(this); DataTable table = manager.GetProductPartsByCompany((int)Company.MatrixId).Sort("ParentId").ToDataTable(); RadTreeView1.DataSource = table; RadTreeView1.DataBind(); lblDelete.Visible = RadTreeView1.Nodes.Count > 0; btnDelete.Visible = RadTreeView1.Nodes.Count > 0; }
void DisableItem() { foreach (object item in RadTreeView1.SelectedItems) { RadTreeViewItem treeViewItem = RadTreeView1.ContainerFromItemRecursive(item); if (treeViewItem != null) { treeViewItem.IsEnabled = false; } } }
protected void AddCategoryClick(object sender, EventArgs e) { string categoryName = popAddCategory.Value; string categoryId = popAddCategory.ReferrerId; string categoryTypeName = string.Empty; // Need to figure out if this is a comms block category or a doco block category. if (!string.IsNullOrEmpty(categoryId)) { BusiBlocks.CommsBlock.News.Category news = null; try { news = NewsManager.GetCategory(categoryId); categoryTypeName = news.GetType().Name; } catch (NewsCategoryNotFoundException) { } if (news != null) { BusiBlocks.CommsBlock.News.Category childCategory = NewsManager.CreateCategory(categoryName); childCategory.ParentCategory = news; NewsManager.UpdateCategory(childCategory); this.PopulateTreeView <BusiBlocks.CommsBlock.News.Category>(NewsManager.GetAllCategories(), true, false, string.Empty); } else { BusiBlocks.DocoBlock.Category doco = null; try { doco = DocoManager.GetCategory(categoryId); categoryTypeName = doco.GetType().Name; } catch (DocoCategoryNotFoundException) { } if (doco != null) { BusiBlocks.DocoBlock.Category childDocoCategory = DocoManager.CreateCategory(categoryName); childDocoCategory.ParentCategory = doco; DocoManager.UpdateCategory(childDocoCategory); this.PopulateTreeView <BusiBlocks.DocoBlock.Category>(DocoManager.GetAllCategories(), true, false, string.Empty); } } RadTreeView1.DataBind(); RadTreeView1.FindNodeByText(categoryName).ExpandParentNodes(); RadTreeView1.FindNodeByText(categoryName).Selected = true; ((IFeedback)this.Page.Master).ShowFeedback( BusiBlocksConstants.Blocks.Administration.LongName, categoryTypeName, Feedback.Actions.Created, categoryName ); } }
protected void Page_Load(object sender, EventArgs e) { Session["idNV"] = null; if (!IsPostBack) { var TreeData = _entities.CoCauToChucs; RadTreeView1.DataTextField = "TenDonVi"; RadTreeView1.DataFieldID = "IDCoCauToChuc"; RadTreeView1.DataFieldParentID = "IDParent"; RadTreeView1.DataSource = TreeData; RadTreeView1.DataBind(); RadTreeView1.Nodes[0].Selected = true; RadTreeNodeEventArgs tne = new RadTreeNodeEventArgs(RadTreeView1.Nodes[0]); RadTreeView1_Nodeclick(sender, tne); } }
private void AddChildNodes(BbTreeViewNode rootNode, RadTreeNode rootNodeRad) { foreach (BbTreeViewNode childNode in rootNode.ChildNodes) { RadTreeNode radChildNode = new RadTreeNode(childNode.Value + childNode.Menu, childNode.Id) { ImageUrl = childNode.Icon }; RadTreeView1.FindNodeByValue(rootNodeRad.Value).Nodes.Add(radChildNode); if (childNode.IsBranch) { AddChildNodes(childNode, radChildNode); } } }
protected void Page_Load(object sender, EventArgs e) { /*if (Session["UserID"] != null )*/ CheckPermis(); if (!IsPostBack) { // fill data treeview var TreeData = from k in _entities.CoCauToChucs select k; RadTreeView1.DataTextField = "TenDonVi"; RadTreeView1.DataFieldID = "IDCoCauToChuc"; RadTreeView1.DataFieldParentID = "IDParent"; RadTreeView1.DataSource = TreeData; RadTreeView1.DataBind(); RadTreeView1.Nodes[0].Selected = true; RadTreeNodeEventArgs tne = new RadTreeNodeEventArgs(RadTreeView1.Nodes[0]); RadTreeView1_Nodeclick(sender, tne); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var dt = _entities.GetAllCVUngVien(); RadGrid1.DataSource = dt; RadGrid1.DataBind(); RadGrid1.Items[0].Selected = true; GridDataItem item = RadGrid1.Items[0]; Int32 IDNhanVien = Int32.Parse(item["IDNhanVien"].Text); FillCurrentEmployeeDetail(IDNhanVien); var TreeData = _entities.GetDotTuyenDung(); RadTreeView1.DataTextField = "TenDotTuyenDung"; RadTreeView1.DataFieldID = "IDDotTuyenDung"; RadTreeView1.DataFieldParentID = "IDParent"; RadTreeView1.DataSource = TreeData; RadTreeView1.DataBind(); } }
void RemoveItem() { while (RadTreeView1.SelectedItems.Count > 0) { RadTreeViewItem treeViewItem = RadTreeView1.ContainerFromItemRecursive(RadTreeView1.SelectedItems[0]); if (treeViewItem == null) { return; } if (treeViewItem.Parent is RadTreeViewItem) { (treeViewItem.Parent as RadTreeViewItem).Items.Remove(treeViewItem); } else { this.RadTreeView1.Items.Remove(treeViewItem); } } }
private object[] GetAccountChildIds(IAccount account) { var accIds = new List <object> { account.Id.ToString() }; var node = RadTreeView1.FindNodeByValue(account.Id.ToString()); if (node != null && node.Nodes != null) { foreach (RadTreeNode kid in node.Nodes) { if (!accIds.Contains(kid.Value)) { var childAccount = EntityFactory.GetById <IAccount>(kid.Value); accIds.AddRange(GetAccountChildIds(childAccount)); } } } return(accIds.ToArray()); }
public void RebindNode(string id, bool showContextMenu) { RadTreeNode node = RadTreeView1.FindNodeByValue(id); Panel pnl = (Panel)node.FindControl("pnlNode"); node.Selected = true; Label plbl = (Label)pnl.FindControl("lblContextMenu"); if (showContextMenu) { plbl.CssClass = id + "_tvContext"; } else { plbl.CssClass = id + "_tvContext hideElement"; } RadTreeView1.DataBind(); node.ExpandParentNodes(); }
private int CalculateQuotesCount(IAccount account) { var qCount = account.Quotes.Count; if (chkCascade.Checked) { var node = RadTreeView1.FindNodeByValue(account.Id.ToString()); if (node != null && node.Nodes != null) { foreach (RadTreeNode kid in node.Nodes) { var childAccount = EntityFactory.GetById <IAccount>(kid.Value); if (childAccount != null) { qCount += CalculateQuotesCount(childAccount); } } } } return(qCount); }
protected void btnDelete_Click(object sender, EventArgs e) { RadTreeNode n = RadTreeView1.FindNodeByValue(txtFile.Text); if (n.Category != "Folder") { string filed = ""; int size = 0; string direc = txtFile.Text; string path = direc.Substring(0, direc.LastIndexOf("\\")); string fild = direc.Substring(path.Length); System.IO.FileInfo fi = new System.IO.FileInfo(direc); if (fi.Exists) { GC.Collect(); fi.Attributes = FileAttributes.Normal; fi.Delete(); createtree(path); } } else { string dir = txtFile.Text; System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dir); di.Attributes = FileAttributes.Normal; if (di.Exists) { GC.Collect(); deletefilesfrfolder(dir); createtree(dir.Substring(0, dir.LastIndexOf("\\"))); } } Session["delete"] = null; }
protected void DeleteCategoryClick(object sender, EventArgs e) { string categoryName = string.Empty; string categoryId = popDeleteCategory.ReferrerId; string categoryTypeName = string.Empty; string parentCategoryName = string.Empty; bool deleteFailure = false; // Need to figure out if this is a comms block category or a doco block category. if (!string.IsNullOrEmpty(categoryId)) { BusiBlocks.CommsBlock.News.Category news = null; try { news = NewsManager.GetCategory(categoryId); } catch (NewsCategoryNotFoundException) { } if (news != null) { categoryTypeName = news.GetType().Name; categoryName = news.Name; // Don't allow the root category to be deleted. if (news.ParentCategory == null) { ((IFeedback)this.Page.Master).ShowFeedback( BusiBlocksConstants.Blocks.Administration.LongName, news.Name, Feedback.Actions.Error, "Cannot delete the highest level category" ); return; } parentCategoryName = news.ParentCategory.Name; IList <BusiBlocks.CommsBlock.News.Item> newsItems = NewsManager.GetItems(news, true); IList <BusiBlocks.CommsBlock.News.Category> newsSubCategories = NewsManager.GetCategories(news.Id, true); // NewsManager.GetCategories returns the root category, so it will always have at least one item if (newsSubCategories.Count <= 1 && newsItems.Count == 0) { NewsManager.DeleteCategory(news); PopulateTreeView <BusiBlocks.CommsBlock.News.Category>(NewsManager.GetViewableCategories(Page.User.Identity.Name), true, false, string.Empty); } else { deleteFailure = true; } } else { BusiBlocks.DocoBlock.Category doco = null; try { doco = DocoManager.GetCategory(categoryId); } catch (DocoCategoryNotFoundException) { } if (doco != null) { categoryTypeName = doco.GetType().Name; categoryName = doco.DisplayName; parentCategoryName = doco.ParentCategory.DisplayName; IList <Article> docoItems = DocoManager.GetArticles(doco, ArticleStatus.All, true); IList <BusiBlocks.DocoBlock.Category> docoSubCategories = DocoManager.GetAllCategoriesBelow(doco.Id); if (docoSubCategories.Count == 0 && docoItems.Count == 0) { DocoManager.DeleteCategory(doco); this.PopulateTreeView <BusiBlocks.DocoBlock.Category>(DocoManager.GetAllCategories(), true, false, string.Empty); } else { deleteFailure = true; } } } RadTreeView1.DataBind(); } //Displaying feedback. if (deleteFailure) { ((IFeedback)this.Page.Master).ShowFeedback( BusiBlocksConstants.Blocks.Administration.LongName, categoryTypeName, Feedback.Actions.Error, ErrorCategoryNotEmpty ); RadTreeView1.FindNodeByText(categoryName).ExpandParentNodes(); RadTreeView1.FindNodeByText(categoryName).Selected = true; } else { ((IFeedback)this.Page.Master).ShowFeedback( BusiBlocksConstants.Blocks.Administration.LongName, categoryTypeName, Feedback.Actions.Deleted, categoryName ); RadTreeView1.FindNodeByText(parentCategoryName).ExpandParentNodes(); RadTreeView1.FindNodeByText(parentCategoryName).Selected = true; } }
protected void RadTreeView1_DataBound(object sender, EventArgs e) { RadTreeView1.ExpandAllNodes(); }
public void HienThiTreeview() { string UserID = (string)Session["UserID"].ToString(); //string UserID = "27276"; string CongTy = "LTY"; RadTreeNode roottree = new RadTreeNode("System"); RadTreeView1.Nodes.Add(roottree); DataTable dtSystem = dalSystem.QryProjectTheoUserID(UserID, CongTy); if (dtSystem.Rows.Count > 0) { foreach (DataRow row in dtSystem.Rows) { string SysID = row["jsysid"].ToString(); string SysName = row["sysname"].ToString(); RadTreeNode nootcha = new RadTreeNode(""); nootcha.Text = SysName; nootcha.Value = SysID; roottree.Nodes.Add(nootcha); roottree.ExpandChildNodes(); DataTable dtProjectm = dalProjectm.QryProjectTheoUserID1(UserID, CongTy, SysID); if (dtProjectm.Rows.Count > 0) { foreach (DataRow dr in dtProjectm.Rows) { string SystemID = dr["jsysid"].ToString(); string subSystemID = dr["jsubid"].ToString(); string subName = dr["jsubname"].ToString(); RadTreeNode parentNode = new RadTreeNode("Sub System"); parentNode.Text = subName; parentNode.ToolTip = subSystemID; parentNode.Value = SystemID.ToString(); nootcha.Nodes.Add(parentNode); nootcha.ExpandChildNodes(); DataTable dtProjects = dalProjects.HienThiDanhSachTheoHeThong(UserID, CongTy, SystemID, subSystemID); if (dtProjects.Rows.Count > 0) { foreach (DataRow drs in dtProjects.Rows) { string systemID = drs["jsysid"].ToString(); string subSystem = drs["jsubid"].ToString(); string jobID = drs["jobid"].ToString(); string jobName = drs["jobname"].ToString(); RadTreeNode childNode = new RadTreeNode(""); childNode.Value = jobID; childNode.ToolTip = subSystem; childNode.Target = systemID.ToString(); childNode.Text = jobName; parentNode.Nodes.Add(childNode); parentNode.ExpandChildNodes(); } } } } } } RadTreeView1.ExpandAllNodes(); }