/// <summary> /// treeViewUO_Collapse /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeViewUO_Collapse(object sender, Microsoft.Web.UI.WebControls.TreeViewClickEventArgs e) { try { if (e.Node != "0") { myTreeNode TreeNodo; TreeNodo = (myTreeNode)treeViewUO.GetNodeFromIndex(e.Node); Microsoft.Web.UI.WebControls.TreeNode nodoFiglio; if (TreeNodo.getTipoNodo().Equals("U")) { if (TreeNodo.Nodes.Count > 0) { TreeNodo.Nodes.Clear(); } nodoFiglio = new Microsoft.Web.UI.WebControls.TreeNode(); nodoFiglio.Text = "<font color='#ff0000'> loading...</font>"; TreeNodo.Nodes.Add(nodoFiglio); } if (this.GetReadOnly()) { treeViewUO.SelectedNodeIndex = e.Node; } } } catch { this.executeJS("<SCRIPT>alert('Attenzione, si è verificato un errore di sistema');</SCRIPT>"); } }
/// <summary> /// treeViewUO_Expand /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeViewUO_Expand(object sender, Microsoft.Web.UI.WebControls.TreeViewClickEventArgs e) { try { if (e.Node != "0") { myTreeNode TreeNodo; TreeNodo = (myTreeNode)treeViewUO.GetNodeFromIndex(e.Node); if (TreeNodo.getTipoNodo().Equals("U")) { if (TreeNodo.Nodes.Count > 0) { TreeNodo.Nodes.Clear(); } this.LoadTreeViewLivelloFigli(e.Node, TreeNodo.getTipoNodo()); } if (this.GetReadOnly()) { treeViewUO.SelectedNodeIndex = e.Node; } } else { this.Inizialize(); } } catch { this.executeJS("<SCRIPT>alert('Attenzione, si è verificato un errore di sistema');</SCRIPT>"); } }
/// <summary> /// espande nodo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TreeView1_Expand_1(object sender, Microsoft.Web.UI.WebControls.TreeViewClickEventArgs e) { try { if (e.Node != "0") { LoadTreeViewChild(e.Node); } } catch { lbl_msg.Text = "Attenzione! si è verificato un errore di caricamento della pagina."; } }
private void TestTreeView_Collapse(object sender, Microsoft.Web.UI.WebControls.TreeViewClickEventArgs e) { // Remove the collapsed node from the expansion list... ((ArrayList)Session["ExpandedNodes"]).Remove(e.Node); // Collapse the node (for state could be saved)... TestTreeView.GetNodeFromIndex(e.Node).Expanded = false; // Expand the nodes that need to be expanded... this.ExpandTreeNodes( ); // Select the node that was previously selected... this.SetSelectedNode( ); // Clear out any visible error messages... ErrorMessage.Text = ""; }
private void TestTreeView_Expand(object sender, Microsoft.Web.UI.WebControls.TreeViewClickEventArgs e) { // Add the newly expanded node to the node array... // If the list doesn't contain the node, then add it to the list... if (Session["ExpandedNodes"] == null) { Session["ExpandedNodes"] = new ArrayList( ); } if (!((ArrayList)Session["ExpandedNodes"]).Contains(e.Node)) { ((ArrayList)Session["ExpandedNodes"]).Add(e.Node); } // Expand the nodes that need to be expanded... this.ExpandTreeNodes( ); // Select the node that was previously selected... this.SetSelectedNode( ); // Clear out any visible error messages... ErrorMessage.Text = ""; }
/// <summary> /// chiude nodo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TreeView1_Collapse_1(object sender, Microsoft.Web.UI.WebControls.TreeViewClickEventArgs e) { try { Microsoft.Web.UI.WebControls.TreeNode nodoFiglio; Microsoft.Web.UI.WebControls.TreeNode TreeNodo; TreeNodo = TreeView1.GetNodeFromIndex(e.Node); if (e.Node != "0") { if (TreeNodo.Nodes.Count > 0) { TreeNodo.Nodes.Clear(); } nodoFiglio = new Microsoft.Web.UI.WebControls.TreeNode(); nodoFiglio.Text = "<font color='#ff0000'> loading...</font>"; TreeNodo.Nodes.Add(nodoFiglio); } } catch { lbl_msg.Text = "Attenzione! si è verificato un errore di caricamento della pagina."; } }
/// <summary> /// Called when the TreeView on the client-side submitted the form. /// </summary> /// <param name="eventArg">Event argument.</param> protected bool ProcessEvents(string eventArg) { if (eventArg == null || eventArg == String.Empty || eventArg == " ") // Don't know why, but the framework is giving a " " eventArg instead of null return false; TreeNode tn = null; String[] events = eventArg.Split(new Char[] {';'}); foreach (string strWholeEvent in events) { String[] parms = strWholeEvent.Split(new Char[] {','}); if (parms[0].Length > 0) { if (parms[0].Equals("onselectedindexchange") && parms.GetLength(0) == 3) { TreeViewSelectEventArgs e = new TreeViewSelectEventArgs(parms[1], parms[2]); tn = GetNodeFromIndex(parms[2]); if (tn != null) tn.LowerPostBackEvent(parms[0]); DoSelectedIndexChange(e); _eventList.Add("s"); _eventList.Add(e); } else if ((parms[0].Equals("onexpand") || parms[0].Equals("oncollapse") || parms[0].Equals("oncheck")) && parms.GetLength(0) == 2) { TreeViewClickEventArgs e = new TreeViewClickEventArgs(parms[1]); if (parms[0].Equals("onexpand")) _eventList.Add("e"); else if (parms[0].Equals("oncollapse")) _eventList.Add("c"); else _eventList.Add("k"); _eventList.Add(e); tn = GetNodeFromIndex(parms[1]); if (tn != null) tn.LowerPostBackEvent(parms[0]); } } } if (_eventList.Count > 0) return true; else return false; }
/// <summary> /// Called when a TreeNode expands. /// </summary> /// <param name="e">Event arguments.</param> protected virtual void OnExpand(TreeViewClickEventArgs e) { if (Expand != null) Expand(this, e); }
/// <summary> /// Called when a TreeNode collapses. /// </summary> /// <param name="e">Event arguments.</param> protected virtual void OnCollapse(TreeViewClickEventArgs e) { if (Collapse != null) Collapse(this, e); }
/// <summary> /// Called when a TreeNode's checkbox is clicked. /// </summary> /// <param name="e">Event arguments.</param> protected virtual void OnCheck(TreeViewClickEventArgs e) { if (Check != null) Check(this, e); }
private void tvSection_Expand(object sender, TreeViewClickEventArgs e) { TreeNode node = tvSection.GetNodeFromIndex(e.Node); if (node.Nodes.Count == 0) { if (node.NodeData.IndexOf("Section") == 0) AddSectionMembers(node); else if (node.NodeData.IndexOf("USects") == 0) AddUserSections(node); else if (node.NodeData.IndexOf("UGrous") == 0) AddUserGroups(node); else if (node.NodeData.IndexOf("GrouAsst") == 0) AddAsstGroups(node); else if (node.NodeData.IndexOf("Group") == 0) AddGroupMembers(node); else if (node.NodeData.IndexOf("AsstG") == 0) AddAllAsstGroups(node); } }
private void tvSection_Check(object sender, TreeViewClickEventArgs e) { TreeNode node = tvSection.GetNodeFromIndex(e.Node); Users users = new Users(Globals.CurrentIdentity); int courseID = Convert.ToInt32(HttpContext.Current.Request.Params["CourseID"]); string[] tokens; if (node.NodeData.IndexOf("Uname") == 0) { tokens = node.NodeData.Split(" ".ToCharArray()); int pid = users.GetInfo(tokens[1], null).PrincipalID; ArrayList prins = Principals; if (node.Checked) prins.Add(pid); else prins.Remove(pid); Principals = prins; } else if (node.NodeData.IndexOf("Group") == 0) { tokens = node.NodeData.Split(" ".ToCharArray()); int pid = Convert.ToInt32(tokens[1]); ArrayList prins = Principals; if (node.Checked) prins.Add(pid); else prins.Remove(pid); Principals = prins; } else if (node.NodeData.IndexOf("Uallusers") == 0) { User.UserList mems = new Courses(Globals.CurrentIdentity).GetMembers(courseID, null); ArrayList prins = Principals; foreach (TreeNode cnode in node.Nodes) cnode.Checked = node.Checked; foreach (User mem in mems) { if (node.Checked) prins.Add(mem.PrincipalID); else prins.Remove(mem.PrincipalID); } node.Expanded = true; Principals = prins; } else if (node.NodeData.IndexOf("Section") == 0) { tokens = node.NodeData.Split(" ".ToCharArray()); User.UserList susers = (new Sections(Globals.CurrentIdentity)).GetMembers( Convert.ToInt32(tokens[1])); if (node.Nodes.Count == 0) AddSectionMembers(node); foreach (TreeNode cnode in node.Nodes) cnode.Checked = node.Checked; ArrayList prins = Principals; foreach (User user in susers) { if (node.Checked) prins.Add(user.PrincipalID); else prins.Remove(user.PrincipalID); } node.Expanded = true; Principals = prins; } }
/// <summary> /// Espande un nodo della Treeview /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeViewUO_Expand(object sender, Microsoft.Web.UI.WebControls.TreeViewClickEventArgs e) { this.executeExpand(e.Node); }
protected void tvFiles_Expand(object sender, TreeViewClickEventArgs e) { TreeNode selnode = tvFiles.GetNodeFromIndex(e.Node); UpdateTreeNode(selnode, false); }
private void tvRubric_Expand(object sender, TreeViewClickEventArgs e) { TreeNode node = tvRubric.GetNodeFromIndex(e.Node); LoadNode(node); }