[CLOSED] How to set checkbox node has been checked?

  1. #1

    [CLOSED] How to set checkbox node has been checked?

    Hi

    This code is a loop to find the treenode and set checked was true
    but checked node always false
    How to resolve it??

      protected void getsubnode(Ext.Net.Node subnode, string step)
        {
            foreach (Ext.Net.Node subnode1 in subnode.Children)
            {
                if (subnode1.Text.Split(' ')[0].ToString() == step)
                    subnode1.Checked = true;
                if (subnode1.Children.Count > 0)
                {
                    subnode1.Expanded = true;
                    getsubnode(subnode1, step);
                }
            }
           mytree.render();
        }
    Last edited by Daniil; Jun 21, 2012 at 10:30 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Is the first 'if' statement ever entered? This sample also only 'sets' the .Checked property. Nowhere in the sample does it 'get' the value of the .Checked property.

    This sample does not do a good job of demonstrating the scenario. Please see the following tips for submitting a forum support request:

    http://forums.ext.net/showthread.php...ing-New-Topics

    http://forums.ext.net/showthread.php...ation-Required
    Geoffrey McGill
    Founder
  3. #3
    When Button clicked, select data from db
    I have to find the treenode, if the treenode text Equal col1 that treenode checked set true
    I know the "node.checked = true" is set the checked box be checked
    but in the code, is not avaliable

    
     protected void buttonclick(object sender, DirectEventArgs e)
        {
             datatable flowtmp;
             for (int k = 0; k < flowtmp.Rows.Count; k++)
                {
                    foreach (Ext.Net.Node mynode in mytree.Root)
                    {
                        if (mynode.Children.Count > 0)
                          mynode.Children[0].Checked = true;
                 
                        if (mynode.Text.Split(' ')[0].ToString() == flowtmp.Rows[k]["col1"].ToString())
                            mynode.Checked = true;
                        foreach (Ext.Net.Node subnode in mynode.Children)
                        {
                            if (subnode.Text.Split(' ')[0].ToString() == flowtmp.Rows[k]["col1"].ToString())
                                subnode.Checked = true;
                            if (subnode.Children.Count > 0)
                            {
                                getsubnode(subnode, flowtmp.Rows[k]["col1"].ToString());
                            }
                        }
                    }
               }
               mytree.Reload();
         
        }
    
        protected void getsubnode(Ext.Net.Node subnode, string step)
        {
            foreach (Ext.Net.Node subnode1 in subnode.Children)
            {
                if (subnode1.Text.Split(' ')[0].ToString() == step)
                    subnode1.Checked = true;
                if (subnode1.Children.Count > 0)
                {
                    subnode1.Expanded = true;
                    getsubnode(subnode1, step);
                }
            }
        }
  4. #4
    I have another idear to add checknode

    use code "mytree.CheckedNodes.Add(checkednode);"

    checkedNodes.Add(SubmmitNode) type must be SubmittNode,

    what's different between SubmittNode and TreeNode??

    How to add CheckedNodes?


    Quote Originally Posted by gs_user View Post
    When Button clicked, select data from db
    I have to find the treenode, if the treenode text Equal col1 that treenode checked set true
    I know the "node.checked = true" is set the checked box be checked
    but in the code, is not avaliable

    
     protected void buttonclick(object sender, DirectEventArgs e)
        {
             datatable flowtmp;
             for (int k = 0; k < flowtmp.Rows.Count; k++)
                {
                    foreach (Ext.Net.Node mynode in mytree.Root)
                    {
                        if (mynode.Children.Count > 0)
                          mynode.Children[0].Checked = true;
                 
                        if (mynode.Text.Split(' ')[0].ToString() == flowtmp.Rows[k]["col1"].ToString())
                            mynode.Checked = true;
                        foreach (Ext.Net.Node subnode in mynode.Children)
                        {
                            if (subnode.Text.Split(' ')[0].ToString() == flowtmp.Rows[k]["col1"].ToString())
                                subnode.Checked = true;
                            if (subnode.Children.Count > 0)
                            {
                                getsubnode(subnode, flowtmp.Rows[k]["col1"].ToString());
                            }
                        }
                    }
               }
               mytree.Reload();
         
        }
    
        protected void getsubnode(Ext.Net.Node subnode, string step)
        {
            foreach (Ext.Net.Node subnode1 in subnode.Children)
            {
                if (subnode1.Text.Split(' ')[0].ToString() == step)
                    subnode1.Checked = true;
                if (subnode1.Children.Count > 0)
                {
                    subnode1.Expanded = true;
                    getsubnode(subnode1, step);
                }
            }
        }
  5. #5
    I find the reason to make checked equal true is not work.
    I change the tree.render() position. It's can work now.

    
     protected void buttonclick(object sender, DirectEventArgs e)
        {
             createtree_procedure();  --> I create a tree code behind ,end of the procedure, I set mytree.render(). 
                                                        I remove mytree.render code
             datatable flowtmp;
             for (int k = 0; k < flowtmp.Rows.Count; k++)
                {
                    foreach (Ext.Net.Node mynode in mytree.Root)
                    {
                        if (mynode.Children.Count > 0)
                          mynode.Children[0].Checked = true;
                 
                        if (mynode.Text.Split(' ')[0].ToString() == flowtmp.Rows[k]["col1"].ToString())
                            mynode.Checked = true;
                        foreach (Ext.Net.Node subnode in mynode.Children)
                        {
                            if (subnode.Text.Split(' ')[0].ToString() == flowtmp.Rows[k]["col1"].ToString())
                                subnode.Checked = true;
                            if (subnode.Children.Count > 0)
                            {
                                getsubnode(subnode, flowtmp.Rows[k]["col1"].ToString());
                            }
                        }
                    }
               }
               mytree.render();  --> I add tree render. It's can work now.
         
        }
    
        protected void getsubnode(Ext.Net.Node subnode, string step)
        {
            foreach (Ext.Net.Node subnode1 in subnode.Children)
            {
                if (subnode1.Text.Split(' ')[0].ToString() == step)
                    subnode1.Checked = true;
                if (subnode1.Children.Count > 0)
                {
                    subnode1.Expanded = true;
                    getsubnode(subnode1, step);
                }
            }
        }

Similar Threads

  1. Replies: 0
    Last Post: Aug 09, 2012, 8:30 AM
  2. [CLOSED] Another way to check checkbox is checked ot not....
    By rosua in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 21, 2012, 5:39 AM
  3. [CLOSED] CheckBox.Checked is not getting set
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 01, 2011, 11:27 AM
  4. Replies: 1
    Last Post: May 24, 2011, 12:23 PM
  5. [CLOSED] [1.0] checkbox.checked not valorized
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 23, 2010, 4:32 AM

Posting Permissions