private void SyncTree() { List <SiteMapNode> lst = new List <SiteMapNode>(); SiteMapNode nd = GetCurrNode(); do { lst.Insert(0, nd); } while((nd = nd.ParentNode) != null); StringBuilder bld = new StringBuilder(); foreach (SiteMapNode nd2 in lst) { if (bld.Length > 0) { bld.Append(TreeView1.PathSeparator); } //bld.Append( nd2.Title ); bld.Append(nd2.Key); TreeNode ndt = TreeView1.FindNode(bld.ToString()); if (ndt != null) { ndt.Select(); ndt.Expand(); } } }
private int CreateNodes(string NodePath, string NodeName, int NodeType, int NodeID, string rootNode) { try { string ParentNodePath = NodePath.Replace("/" + NodeName + "/", ""); ParentNodePath = ParentNodePath.Replace(rootNode, ""); TreeNode ParentNode = TreeView1.FindNode(ParentNodePath); if (ParentNode != null) { TreeNode NewNode = new TreeNode(NodeName, NodeName.ToString(), getNodeImageURL(NodeName)); NewNode.SelectAction = TreeNodeSelectAction.SelectExpand; NewNode.Collapse(); ParentNode.ChildNodes.Add(NewNode); } if (ParentNode == null) { TreeNode NewNode = new TreeNode(NodeName, NodeName.ToString(), getNodeImageURL(NodeName)); NewNode.SelectAction = TreeNodeSelectAction.SelectExpand; NewNode.Expand(); TreeView1.Nodes.Add(NewNode); } } catch (Exception ex) { throw ex; } return(0); }
protected void imgbtn_Edit_Click(object sender, ImageClickEventArgs e) { GridViewRow gv_row = (GridViewRow)((sender as ImageButton).NamingContainer); string userid = Convert.ToString(gv_users.DataKeys[gv_row.RowIndex].Value); ds_analytics.m_usersDataTable thisuser_dt = m_users.getUserByUserid(userid); if (thisuser_dt.Rows.Count > 0) { ds_analytics.m_usersRow user_row = thisuser_dt[0]; lbl_userid.Text = user_row.userid; if (user_row.IsfullnameNull()) { tb_username.Text = ""; } else { tb_username.Text = user_row.fullname; } if (user_row.IsemailNull()) { tb_email.Text = ""; } else { tb_email.Text = user_row.email; } if (user_row.IsmblnoNull()) { tb_mblno.Text = ""; } else { tb_mblno.Text = user_row.mblno; } cb_isactive.Checked = user_row.isactive; foreach (TreeNode node_parent in TreeView1.Nodes) { foreach (TreeNode node_child in node_parent.ChildNodes) { node_child.Checked = false; } } DataTable dt_rights = m_users.getAccessRightsByUserid(user_row.userid); foreach (DataRow dr in dt_rights.Rows) { TreeView1.FindNode(dr["module_key"].ToString() + TreeView1.PathSeparator + dr["submodule_key"].ToString()).Checked = true; } ViewState["user_row"] = user_row; btn_update.Visible = true; btn_cancel.Visible = true; } else { ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('Error in reading user details.');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack == true) { String sql = "selECt * from Treeview "; SqlDataReader datar = DBHelper.GetReader(sql); TreeNode _tnode; while (datar.Read()) { if (datar["er_id"].ToString() == "0") { _tnode = new TreeNode(); _tnode.Text = datar["name"].ToString(); _tnode.Value = "yi_" + datar["yi_id"].ToString(); TreeView1.Nodes.Add(_tnode); } else { TreeNode _er_path = new TreeNode(); _er_path = TreeView1.FindNode("yi_" + datar["er_id"].ToString()); TreeNode _tnode1 = new TreeNode(); _tnode1.Text = datar["name"].ToString(); _tnode1.Value = "er_" + datar["er_id"].ToString(); _er_path.ChildNodes.Add(_tnode1); } } } DBHelper.CloseConnection(); }
private void TreeView1_Load(object sender, EventArgs e) { listNews = new List <New>(dbAccess.getNews()); listArticles = new List <Article>(dbAccess.getArticles()); TreeNodeCollection newsNodes = TreeView1.FindNode("News.Root").ChildNodes; TreeNodeCollection articlesNodes = TreeView1.FindNode("Articles.Root").ChildNodes; newsNodes.Clear(); foreach (New news in listNews) { TreeNode newNode = new TreeNode(news.Title); TreeNode nodeTxt = new TreeNode(news.Text); nodeTxt.SelectAction = TreeNodeSelectAction.None; newNode.ChildNodes.Add(nodeTxt); newNode.SelectAction = TreeNodeSelectAction.None; newsNodes.Add(newNode); } articlesNodes.Clear(); foreach (Article article in listArticles) { TreeNode newNode = new TreeNode(article.Title); TreeNode nodeTxt = new TreeNode(article.Text); nodeTxt.SelectAction = TreeNodeSelectAction.None; newNode.ChildNodes.Add(nodeTxt); newNode.SelectAction = TreeNodeSelectAction.None; articlesNodes.Add(newNode); } }
protected void Button2_Click(object sender, EventArgs e) { TreeNode tn = new TreeNode(); tn.Text = "笔记本"; tn.Value = "笔记本"; Response.Write(TreeView1.FindNode("硬件产品")); //TreeNode parentNode = TreeView1.FindNode("硬件产品"); //parentNode.ChildNodes.Add(tn); }
protected void Button3_Click(object sender, EventArgs e) { TreeNode _treeNode = new TreeNode(); _treeNode.Text = "新添加节点"; _treeNode.Value = "V_NEW"; TreeNode _pTreeNode = TreeView1.FindNode("222/B1"); _pTreeNode.ChildNodes.Add(_treeNode); }
protected void BtnSearch_Click(object sender, EventArgs e) { //loadTreeMenu(TreeView1, LoadDataTable()); Session["Active"] = "1"; FindNodesByString(); TreeNode searchNode = TreeView1.FindNode(TxtSearch.Text); if (searchNode != null) { searchNode.Expand(); } LabelErrorMessage.Text = "Finished searching"; }
protected void btnSave_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(3000); if (txtSegCode.Text != "") { SegCoa sgcoa = SegCoaManager.getSegCoa(txtSegCode.Text); if (sgcoa != null) { sgcoa.SegCoaDesc = txtSegDesc.Text; sgcoa.RootLeaf = ddlRootLeaf.SelectedValue; sgcoa.Taxable = ddlTaxable.SelectedValue; sgcoa.Status = ddlStatus.SelectedValue; sgcoa.PostAllowed = ddlPostAllowed.SelectedValue; sgcoa.ParentCode = txtParentCode.Text; sgcoa.OpenDate = txtOpenDate.Text; sgcoa.LvlCode = txtLvlCode.Text; sgcoa.BudAllowed = ddlBudAllowed.SelectedValue; sgcoa.AccType = ddlAccType.SelectedValue; SegCoaManager.UpdateSegCoa(sgcoa); } else { sgcoa = new SegCoa(); sgcoa.GlSegCode = txtSegCode.Text; sgcoa.BookName = Session["book"].ToString(); sgcoa.SegCoaDesc = txtSegDesc.Text; sgcoa.RootLeaf = ddlRootLeaf.SelectedValue; sgcoa.Taxable = ddlTaxable.SelectedValue; sgcoa.Status = ddlStatus.SelectedValue; sgcoa.PostAllowed = ddlPostAllowed.SelectedValue; sgcoa.ParentCode = txtParentCode.Text; sgcoa.OpenDate = txtOpenDate.Text; sgcoa.LvlCode = txtLvlCode.Text; sgcoa.BudAllowed = ddlBudAllowed.SelectedValue; sgcoa.AccType = ddlAccType.SelectedValue; SegCoaManager.CreateSegCoa(sgcoa); } TreeView1.Nodes.Clear(); Populate(); TreeNode node = TreeView1.FindNode(Server.HtmlEncode(txtParentCode.Text)); if (node != null) { node.Expand(); } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ale", "alert('***Segment Codes Saved in Database Successfully!!');", true); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ale", "alert('***Segment Codes Saved in Database Successfully!!');", true); } }
protected void maketree() { TreeNode _tNode, _parentNode; DataTable province = bind(" select * from `hjmall_district1` where `level`='p' "); if (province == null || province.Rows.Count <= 0) { throw new Exception(); } foreach (DataRow row in province.Rows) { _tNode = new TreeNode(); _tNode.Text = row["name"].ToString(); _tNode.Value = "p_" + row["id"].ToString(); TreeView1.Nodes.Add(_tNode); } DataTable city = bind(" select * from `hjmall_district1` where `level`='c' "); foreach (DataRow row1 in city.Rows) { _parentNode = TreeView1.FindNode("p_" + row1["parent_id"].ToString()); _tNode = new TreeNode(); _tNode.Text = row1["name"].ToString(); _tNode.Value = "c_" + row1["id"].ToString(); _parentNode.ChildNodes.Add(_tNode); } DataTable district = bind(" select t1.`id`,t1.`name`,t1.`parent_id` as `p_id`,t2.`parent_id` as `pp_id` from `hjmall_district1` t1 left join " + " `hjmall_district1` t2 on t1.`parent_id`=t2.`id` " + " where t1.`level`='d' "); foreach (DataRow row2 in district.Rows) { _parentNode = TreeView1.FindNode("p_" + row2["pp_id"].ToString() + "/c_" + row2["p_id"].ToString()); _tNode = new TreeNode(); _tNode.Text = row2["name"].ToString(); _tNode.Value = "d_" + row2["id"].ToString(); _parentNode.ChildNodes.Add(_tNode); } }
protected void NonMaketree() { TreeNode _tNode, _parentNode; _tNode = new TreeNode(); _tNode.Text = "湖南"; _tNode.Value = "p_1"; TreeView1.Nodes.Add(_tNode); //子级2 _parentNode = TreeView1.FindNode("p_1"); _tNode = new TreeNode(); _tNode.Text = "长沙"; _tNode.Value = "c_2"; _parentNode.ChildNodes.Add(_tNode); //子级3 _parentNode = TreeView1.FindNode("p_1/c_2"); _tNode = new TreeNode(); _tNode.Text = "岳麓区"; _tNode.Value = "d_3"; _parentNode.ChildNodes.Add(_tNode); }
protected void Page_Load(object sender, EventArgs e) { string First = null; string Middle = null; string Last = null; try { SessionBo.CheckSession(); customerVo = (CustomerVo)Session[SessionContents.CustomerVo]; userVo = (UserVo)Session[SessionContents.UserVo]; if (customerVo != null) { Session[SessionContents.FPS_ProspectList_CustomerId] = customerVo.CustomerId; } if (!IsPostBack) { First = customerVo.FirstName.ToString(); Middle = customerVo.MiddleName.ToString(); Last = customerVo.LastName.ToString(); if (Middle != "") { lblNameValue.Text = customerVo.FirstName.ToString() + " " + customerVo.MiddleName.ToString() + " " + customerVo.LastName.ToString(); } else { lblNameValue.Text = customerVo.FirstName.ToString() + " " + customerVo.LastName.ToString(); } lblEmailIdValue.Text = customerVo.Email.ToString(); string IsDashboard = string.Empty; if (Session["IsDashboard"] != null) { IsDashboard = Session["IsDashboard"].ToString(); } if (IsDashboard == "true") { TreeView1.CollapseAll(); TreeView1.FindNode("Customer Dashboard").Selected = true; Session["IsDashboard"] = "false"; } else if (Session[SessionContents.FPS_TreeView_Status] != null) { if (Session[SessionContents.FPS_TreeView_Status].ToString() == "FinanceProfile") { TreeView1.CollapseAll(); TreeView1.FindNode("Financial Planning").Expand(); //TreeView1.FindNode("Finance Profile").Selected = true; TreeView1.SelectedNode.Text = "Finance Profile"; } } else { TreeView1.CollapseAll(); TreeView1.FindNode("Profile Dashboard").Expand(); TreeView1.FindNode("Profile Dashboard").Selected = true; } } ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadtopmenu('CustomerNonIndividualLeftPane');", true); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "RMCustomerNonIndividualLeftPane.ascx.cs:Page_Load()"); object[] objects = new object[4]; objects[0] = customerVo; objects[1] = First; objects[2] = Middle; objects[3] = Last; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void Page_Load(object sender, EventArgs e) { //if (!IsPostBack) //{ // customerVo = (CustomerVo)Session[SessionContents.CustomerVo]; // string First = customerVo.FirstName.ToString(); // string Middle = customerVo.MiddleName.ToString(); // string Last = customerVo.LastName.ToString(); // if (Middle != "") // { // lblNameValue.Text = customerVo.FirstName.ToString() + " " + customerVo.MiddleName.ToString() + " " + customerVo.LastName.ToString(); // } // else // { // lblNameValue.Text = customerVo.FirstName.ToString() + " " + customerVo.LastName.ToString(); // } // lblEmailIdValue.Text = customerVo.Email.ToString(); //} SessionBo.CheckSession(); customerVo = (CustomerVo)Session[SessionContents.CustomerVo]; if (customerVo != null) { Session[SessionContents.FPS_ProspectList_CustomerId] = customerVo.CustomerId; } if (!IsPostBack) { isGrpHead = customerBo.CheckCustomerGroupHead(customerVo.CustomerId); if (isGrpHead == true) { TreeView1.Nodes.AddAt(0, new TreeNode("Group Home")); Session["IsDashboard"] = "true"; } else { Session["IsDashboard"] = "CustDashboard"; } string IsDashboard = string.Empty; if (Session["IsDashboard"] != null) { IsDashboard = Session["IsDashboard"].ToString(); } if (IsDashboard == "true") { TreeView1.CollapseAll(); if (customerVo.RelationShip == "SELF") { TreeView1.FindNode("Group Home").Selected = true; } else { TreeView1.FindNode("Customer Dashboard").Selected = true; } Session["IsDashboard"] = "false"; } else if (IsDashboard == "CustDashboard") { TreeView1.CollapseAll(); TreeView1.FindNode("Customer Dashboard").Selected = true; } else { TreeView1.CollapseAll(); TreeView1.FindNode("Profile Dashboard").Expand(); TreeView1.FindNode("Profile Dashboard").Selected = true; } } ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "leftpane", "loadtopmenu('CustomerIndividualLeftPane');", true); }
protected void Page_Load(object sender, EventArgs e) { bool isGrpHead = false; try { SessionBo.CheckSession(); customerVo = (CustomerVo)Session["CustomerVo"]; if (customerVo != null) { Session[SessionContents.FPS_ProspectList_CustomerId] = customerVo.CustomerId; } if (!IsPostBack) { //customerVo = (CustomerVo)Session["CustomerVo"]; //customerVo = (CustomerVo)Session["CustomerVo"]; if (customerVo.FirstName != null && customerVo.MiddleName != null && customerVo.LastName != null) { string First = customerVo.FirstName.ToString(); string Middle = customerVo.MiddleName.ToString(); string Last = customerVo.LastName.ToString(); isGrpHead = customerBo.CheckCustomerGroupHead(customerVo.CustomerId); if (isGrpHead == true) { TreeView1.Nodes.AddAt(1, new TreeNode("Group Dashboard")); } if (Middle != "") { lblNameValue.Text = customerVo.FirstName.ToString() + " " + customerVo.MiddleName.ToString() + " " + customerVo.LastName.ToString(); } else { lblNameValue.Text = customerVo.FirstName.ToString() + " " + customerVo.LastName.ToString(); } lblEmailIdValue.Text = customerVo.Email.ToString(); } TreeView1.CollapseAll(); TreeView1.FindNode("Portfolio Dashboard").Expand(); } if (customerVo.UserType == "IND") { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadtopmenu('CustomerIndividualLeftPane');", true); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "loadtopmenu('CustomerNonIndividualLeftPane');", true); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "PortfolioLeftPane.ascx:Page_Load()"); object[] objects = new object[1]; objects[0] = customerVo; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
protected void Page_Load(object sender, EventArgs e) { SessionBo.CheckSession(); string First = null; string Middle = null; string Last = null; bool isGrpHead = false; try { if (!IsPostBack) { customerVo = (CustomerVo)Session[SessionContents.CustomerVo]; First = customerVo.FirstName.ToString(); Middle = customerVo.MiddleName.ToString(); Last = customerVo.LastName.ToString(); isGrpHead = customerBo.CheckCustomerGroupHead(customerVo.CustomerId); if (isGrpHead == true) { TreeView1.Nodes.AddAt(1, new TreeNode("Group Dashboard")); } if (Middle != "") { lblNameValue.Text = customerVo.FirstName.ToString() + " " + customerVo.MiddleName.ToString() + " " + customerVo.LastName.ToString(); } else { lblNameValue.Text = customerVo.FirstName.ToString() + " " + customerVo.LastName.ToString(); } TreeView1.CollapseAll(); TreeView1.FindNode("Alert Dashboard").Expand(); TreeView1.FindNode("Alert Dashboard").ChildNodes[0].Selected = true; lblEmailIdValue.Text = customerVo.Email.ToString(); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "RMCustomerIndividualLeftPane.ascx.cs:Page_Load()"); object[] objects = new object[4]; objects[0] = customerVo; objects[1] = First; objects[2] = Middle; objects[3] = Last; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
/// <summary> /// Действия после выбора узла дерева /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { //Загружаем подгруппы MainDataClassesDataContext dataContext = new MainDataClassesDataContext(); ISingleResult <ogk_SelectArticleGroupsResult> a = dataContext.ogk_SelectArticleGroups(Convert.ToInt32(TreeView1.SelectedNode.Value), Convert.ToInt32(ArticleTypesList.SelectedValue)); List <ogk_SelectArticleGroupsResult> b = a.ToList(); //Формируем вид таблицы для последующего заполнения DataTable dt = new DataTable(); dt.Columns.Add("Image"); dt.Columns.Add("Название группы"); dt.Columns.Add("Префикс"); dt.Columns.Add("ID"); string imageUrl = "../Icons/folder.png"; for (int i = 0; i < b.Count; i++) { //Добавляем строку в таблицу dt.Rows.Add(imageUrl, b.ElementAt(i).NAME, b.ElementAt(i).PREFIX, b.ElementAt(i).ID.ToString()); } //Показываем панель со списком изделий группы Panel1.Visible = true; ////Настраиваем ширину ячеек таблицы //Столбец изображений элементов GridView1.Columns[0].ItemStyle.CssClass = "productImageColumn"; //Столбец названий групп GridView1.Columns[1].ItemStyle.CssClass = "groupNameColumn"; //Столбец префиксов GridView1.Columns[2].ItemStyle.CssClass = "groupPrefix"; //Столбец ID групп GridView1.Columns[3].ItemStyle.CssClass = "productIdColumn"; GridView1.DataSource = dt; GridView1.DataBind(); if (IsPostBack) { //Записываем значение выбранной группы в скрытую переменную parentGroupID.Value = TreeView1.SelectedNode.Value; TreeView1.SelectedNode.ChildNodes.Clear(); //Если добавляем группу во "Все группы" if (targetGroup == "0") { //Запоминаем путь до выбранного узла дерева string nodePath = TreeView1.SelectedNode.ValuePath.ToString(); //Перезагружаем дерево LoadTreeView(); //Отыскиваем выбранный ранее узел в новом дереве и выбираем его TreeView1.FindNode(nodePath).Select(); ExpandBranchNodes(TreeView1.SelectedNode); } else { LoadTreeNodeChildren(TreeView1.SelectedNode); } } }