[CLOSED] TreePanel CheckNodes Null when checking them from codebehind

  1. #1

    [CLOSED] TreePanel CheckNodes Null when checking them from codebehind

    Hi,

    I create a treepanel codebehind and select data from db
    If the node equal db data, I set checked to be true
    The nodes are perfectly checked on screen when necessary.
    When saving the form again without changing the checklist, the following code CheckedNodes was null
    The nodes checked on screen was correct, why the CheckedNodes was null????

    if (this.mytree.CheckedNodes != null)  --> checknodes was always null,even the nodes on screen was checked
                {
    
                    foreach (SubmittedNode node in this.mytree.CheckedNodes)
                    {
                       save in db
                     }
                    }
    I make a sample, that message about checkednodes count never showup.
    Because CheckedNodes always null.

    <%@ Page Language="C#" %>
    
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
        protected void getchecknode(object sender, DirectEventArgs e)
        {
            
            if (TreePanel1.CheckedNodes != null)
                X.Msg.Alert("message", TreePanel1.CheckedNodes.Count.ToString()).Show();
    
        }
    
    </script>
    
    
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server">
            </ext:ResourceManager>
            <ext:TreePanel ID="TreePanel1" runat="server" Height="300" Title="Title">
                 <Root>
                    <ext:Node Text="start">
                        <Children>
                           <ext:Node Text="node 1" Checked="false" Leaf="true">
                           </ext:Node>
                              <ext:Node Text="node 2" Checked="True" Leaf="true">
                           </ext:Node>
                              <ext:Node Text="node 3" Checked="false" Leaf="true">
                           </ext:Node>
                        </Children>
                    </ext:Node>
                 </Root>
            </ext:TreePanel>
            <ext:Button ID="Button1" runat="server" Text="click">
               <DirectEvents>
                  <Click OnEvent="getchecknode"></Click>
               </DirectEvents>
            </ext:Button>
        </div>
        </form>
    </body>
    </html>
    Last edited by Daniil; Jun 25, 2012 at 6:33 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Thanks for the report. We will investigate and fix.

    For now, please set up the following Before handler for the DirectEvent.
    <Click OnEvent="getchecknode" Before="App.TreePanel1.updateCheckSelection();" />
  3. #3
    Fixed in SVN

Similar Threads

  1. [CLOSED] CheckNodes always one less
    By gs_user in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 03, 2012, 6:19 AM
  2. Replies: 14
    Last Post: May 16, 2012, 7:26 AM
  3. Replies: 2
    Last Post: Jun 14, 2010, 2:47 PM
  4. [CLOSED] Refreshing TreePanel in codebehind
    By jcanton in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 07, 2009, 8:05 AM
  5. TreePanel can not show in codebehind
    By bluebirdzx in forum 1.x Help
    Replies: 2
    Last Post: Apr 20, 2009, 11:37 PM

Posting Permissions