View Full Version : [CLOSED] TreePanel CheckNodes Null when checking them from codebehind

Jun 24, 2012, 1:46 PM

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();



<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
<ext:TreePanel ID="TreePanel1" runat="server" Height="300" Title="Title">
<ext:Node Text="start">
<ext:Node Text="node 1" Checked="false" Leaf="true">
<ext:Node Text="node 2" Checked="True" Leaf="true">
<ext:Node Text="node 3" Checked="false" Leaf="true">
<ext:Button ID="Button1" runat="server" Text="click">
<Click OnEvent="getchecknode"></Click>

Jun 25, 2012, 12:56 PM

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();" />

Jun 25, 2012, 6:28 PM
Fixed in SVN