Jun 24, 2012, 1:46 PM
[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????
Because CheckedNodes always null.
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]