C# .NET - particular Parent Node cell visible false in aspxtreelist

Asked By raj kumar on 23-May-12 07:18 AM
test1    1  2 //Parent Node
test11 test12 //Child Node
test2    1          2
test21 test22


above example in aspxtreelist.

I want 1 and 2 cell is disable in aspxtreelist
Jitendra Faye replied to raj kumar on 23-May-12 08:07 AM
for this first you need to iterate all the nodes in treeview after that based on node value you have to disable them.

try this code-

private void PrintRecursive(TreeNode treeNode)
{
 
 
  if(treeNode.Text=="1" || treeNode.Text=="2")
    {
    treeNode.Enabled=false;
    }

   foreach (TreeNode tn in treeNode.Nodes)
   {
    PrintRecursive(tn);
   }
}

// Call the procedure using the TreeView.
private void CallRecursive(TreeView treeView)
{
   // Print each node recursively.
   TreeNodeCollection nodes = treeView.Nodes;
   foreach (TreeNode n in nodes)
   {
    PrintRecursive(n);
   }
}


Hope this will help you
Goniey N replied to raj kumar on 23-May-12 08:34 AM
For the ASPxTreeList, there are totally other kind of coding, because it's a control of the DevExpress. All Properties & events are totally different.

For your problem there is one event CustomCallback, which will help you...


In the ASPxTreelist, there is no kind of property called Enable or Visible for Node, so we have to delete or remove that particular node...This is the only one way...

See below code, Which will remove Nodes from the ASPxTreelist...


protected void ASPxTreeList1_CustomCallback(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e)

{

      foreach (DevExpress.Web.ASPxTreeList.TreeListNode node in ASPxTreeList1.Nodes)

      {

        if (node.GetValue("1") == "1" || node.GetValue("2") == "2")

        {

          ASPxTreeList1.DeleteNode(node.Key);

        }

      }

      ASPxTreeList1.DataBind();

}



In the above code i have passed the "1" & "2" as fieldNames of the ASPxTreelist, so you have to use your fieldnames instead of this...


Hope this will helpful to you...
help
checkbox to a treeview parent Silverlight / WPF 10-Aug-13 06:21 PM Hello all i have a treeview displaying hierarchical data. i have added checkboxes to the parent. now how do i know that which parent is checked? on checking the checkbox the row is not checkbox is checked or not - Javascript function client_OnTreeNodeChecked( event ) { var TreeNode = event .srcElement | | event .target ; if (TreeNode.tagName = = "INPUT" && TreeNode.type = = "checkbox" ) { if (TreeNode.checked) { / / add the current node to
10-Aug-13 06:49 PM I tried to add treeview control in form_load. And I need a context menu for parent, child and grand child. My code is shown below. when I run, I am getting an error at "load.SelectedNode.Parent.Nodes.Add(t1)" as "An unhandled exception of type 'System to an instance of an object." Dim load As New TreeView Dim t1 As New TreeNode Dim t2 As New TreeNode Dim t3 As New TreeNode Dim i1 As New TreeNode Dim i2 As New TreeNode Dim i3 As New TreeNode
tree view parent node C# .NET 10-Aug-13 06:23 PM how to create parent node after button with new folder name in treeview. . . pls help me out with some code. . . . hi myTreeview.Nodes will build a list of root nodes with children: IList<TreeNode> nodesWithChildren = new List<TreeNode> (); foreach ( TreeNode node in myTreeview.Nodes ) if ( node.Nodes.Count > 0 ) nodesWithChildren node ); Update: and if you wanted all nodes in the TreeView that had a child regardless of how deep into the use a bit of recursion, e.g. private static IList<TreeNode> BuildParentNodeList(TreeView treeView) { IList<TreeNode> nodesWithChildren = new List<TreeNode> (); foreach
Treeview C# .NET 10-Aug-13 06:46 PM I am deep directory and i can not seem to get this treeview to work with me. . i had it working another way new DirectoryInfo(Server.MapPath("~ / Users / "UserName" / Tree")); LoopDirs(DI); } private TreeNode PARENT; TreeNode tn; private void LoopDirs(DirectoryInfo DI) { foreach (DirectoryInfo dinfo in DI.GetDirectories()) { if (PARENT = = null) { tn = new TreeNode(dinfo.Name, dinfo.Name); this.TreeView1.Nodes[0].ChildNodes.Add tn); PARENT = tn; } else { tn = new TreeNode(dinfo.Name, dinfo.Name); PARENT
How to add nodes / subnodes programmatically to treeview. . . . C# .NET 10-Aug-13 06:31 PM How to add nodes / subnodes programmatically to treeview. . . . Hi, Find the sample code below. . TreeView tree = new TreeView(); TreeNode userTools = new TreeNode(); userTools.Text = "User Tools"; tree.Nodes.Add(userTools); TreeNode userTool1 = new TreeNode(); userTool1.Text = "User Tool 1"; tree.Nodes[tree.Nodes.IndexOf
How to give javascript onclick function for treeview parent node in asp.net? ASP.NET 10-Aug-13 06 Hi all, I have developed a web application which contains treeview control. In this treeview control has binded with some database value. . that controls has one parent node , more than one child nodes for each parent node. I have written "treeView_SelectedNodeChanged" event for parent node. When the user clicks parent node then it will fire. my problem is here, when
treeview ASP.NET 10-Aug-13 06:31 PM Hii How to assign treenode to a textbox and how to remove that node when 3600.0%2c+Culture%3dneutral%2c+PublicKeyToken%3db03f5f7f11d50a3a&namespace = System.Web.UI.WebControls&class = TreeView The ASP.NET TreeView control is a powerful server-control for rendering TreeView UI, as shown in the figure below. It supports a defined trees, to dynamically constructed trees, to databound trees. The TreeView's rendering is fully customizable, allowing for a wide-range of look-and-feels for the control. The TreeView supports both postback-style events and simple hyperlink navigation, as The statically-defined tree is the simplest form of the TreeView, demonstrated below. Note that the persistence format for the TreeView
TreeView With Multiple TreeNodes? 10-Aug-13 06:24 PM Hi I am new to DotNet I want to create a TreeView with multiple nodes. I need basic things for static and dynamic pages. thanks Working with treeview the below link will help you how to: http: / / www and the navigateurl property of each node For ex: < asp : TreeView ID = "TreeView1" runat = "server" > < Nodes > < asp : TreeNode NavigateUrl = "~ / Default.aspx" Text = "Home" Value = "Home" > < asp : TreeNode NavigateUrl = "~ / chat.aspx" Text = "Page 2" Value = "Page 2" > < / asp TreeNode > < / asp : TreeNode > < / Nodes > < / asp : TreeView > Second way you can bind it using
Disable TreeView Node C# .NET 10-Aug-13 06:43 PM Hi all, Can anyone tell me how I Disable a TreeView Node. It's possible for the total TreeView but I can't find a solution for a single is an example just you look for detail, tnload0 = new TreeNode(); tnload0.Text = sdr["aCompany"].ToString(); tnload1 = new TreeNode(); tnload1.Text = sdr["aAuthority"].ToString(); tnload2 = new TreeNode(); tnload2.Text = sdr["aPerson"].ToString(); tnload1.Nodes.Add(tnload2); tnload0 Forms; using System.Collections; namespace CustomTreeAuthority { public partial class AuthorityTreeView : TreeView { private static bool _singletonComponetFlag = false; protected TreeNode tn; protected TreeNode selectednode; protected TreeNode tnload0; protected TreeNode tnload1