//Collaps and Expand the selected node && generate node changed event protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { string nm = Database_TreeView.SelectedNode.Value; if (Database_TreeView.SelectedNode.ChildNodes.Count > 0) { if (Database_TreeView.SelectedNode.Depth == 0) { if (Database_TreeView.SelectedNode.Expanded.HasValue) { if (!Database_TreeView.SelectedNode.Expanded.Value) { Database_TreeView.CollapseAll(); } } } if (Database_TreeView.SelectedNode.Expanded.HasValue) { if (Database_TreeView.SelectedNode.Expanded.Value) { Database_TreeView.SelectedNode.Collapse(); } else { Database_TreeView.SelectedNode.Expand(); } } else { Database_TreeView.SelectedNode.Expand(); } } Database_TreeView.SelectedNode.Selected = false; }
protected void Database_TreeView_SelectedNodeChanged(object sender, EventArgs e) { if (Database_TreeView.SelectedNode.ChildNodes.Count > 0) { if (Database_TreeView.SelectedNode.Depth == 0) { if (Database_TreeView.SelectedNode.Expanded.HasValue) { if (!Database_TreeView.SelectedNode.Expanded.Value) { Database_TreeView.CollapseAll(); } } } if (Database_TreeView.SelectedNode.Expanded.HasValue) { if (Database_TreeView.SelectedNode.Expanded.Value) { Database_TreeView.SelectedNode.Collapse(); } else { Database_TreeView.SelectedNode.Expand(); } } else { Database_TreeView.SelectedNode.Expand(); } } Database_TreeView.SelectedNode.Selected = false; //if (Database_TreeView.SelectedNode.Depth == 0) //{ /*if (Database_TreeView.SelectedNode.Expanded.Value) * { * Database_TreeView.SelectedNode.CollapseAll(); * } * else * { * for (int i = 0; i < ProviderTable.Rows.Count; i++) * { * * if (!Database_TreeView.SelectedNode.Value.Equals(ProviderTable.Rows[i][0].ToString())) * { * Database_TreeView.Nodes[i].Collapse(); * } * else * { * Database_TreeView.Nodes[i].Expand(); * } * } * }*/ }
protected void Database_TreeView_TreeNodeExpanded(object sender, TreeNodeEventArgs e) { if (e.Node.Depth == 0) { Database_TreeView.TreeNodeCollapsed -= Database_TreeView_TreeNodeCollapsed; Database_TreeView.TreeNodeExpanded -= Database_TreeView_TreeNodeExpanded; Database_TreeView.CollapseAll(); e.Node.Expand(); Database_TreeView.TreeNodeCollapsed += Database_TreeView_TreeNodeCollapsed; Database_TreeView.TreeNodeExpanded += new TreeNodeEventHandler(Database_TreeView_TreeNodeExpanded); } vpath.Add(e.Node.ValuePath); Session["Treeview_Expand"] = vpath; }
protected void Database_TreeView_SelectedNodeChanged(object sender, EventArgs e) { if (Database_TreeView.SelectedNode.ChildNodes.Count > 0) { if (Database_TreeView.SelectedNode.Depth == 0) { if (Database_TreeView.SelectedNode.Expanded.HasValue) { if (!Database_TreeView.SelectedNode.Expanded.Value) { Database_TreeView.CollapseAll(); } } } if (Database_TreeView.SelectedNode.Expanded.HasValue) { if (Database_TreeView.SelectedNode.Expanded.Value) { Database_TreeView.SelectedNode.Collapse(); } else { Database_TreeView.SelectedNode.Expand(); } } else { Database_TreeView.SelectedNode.Expand(); } } if (Database_TreeView.SelectedNode.Depth == 0) { Response.Redirect("~/CreateDatabase.aspx", false); } else if (Database_TreeView.SelectedNode.Depth == 1) { Response.Redirect("database_structure.aspx?provider=" + Database_TreeView.SelectedNode.Parent.Value + "&dbnm=" + Database_TreeView.SelectedNode.Value, false); } else if (Database_TreeView.SelectedNode.Depth == 2) { Response.Redirect("~/Table_Pages/table_browse.aspx?provider=" + Database_TreeView.SelectedNode.Parent.Parent.Value + "&dbnm=" + Database_TreeView.SelectedNode.Parent.Value + "&tbnm=" + Database_TreeView.SelectedNode.Value, false); } Database_TreeView.SelectedNode.Selected = false; }