Mar 21, 2011, 8:10 AM
TreePanel shows only default Icons when TreePanel.AppendChild is used unless we set the IconFile
Hello , It seems when we build treePanel dynamically it shows only the default icons unless we explicitly set the icon file Node. The following example demonstrates this fact.
Comment in the line starting with // IconFile .... (line 9) then it works properly. There should not be need for this since we give the icon in the constructor of the treenode anyway.
Comment in the line starting with // IconFile .... (line 9) then it works properly. There should not be need for this since we give the icon in the constructor of the treenode anyway.
<%@ Page Language="C#" %>
<script runat="server">
protected override void OnLoad(EventArgs e)
{
var newNode = new Ext.Net.TreeNode("1", "test", Icon.Folder)
{
// IconFile = ResourceManager1.GetIconUrl(Icon.Folder)
};
TreePanel1.AppendChild("root", newNode);
}
</script>
<%@ Import Namespace="System.Collections.Generic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Multi Node TreePanel built using markup - Ext.NET Examples</title>
<link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<h1>Multi Node TreePanel built using markup</h1>
<ext:TreePanel
ID="TreePanel1"
runat="server"
Width="300"
Height="450"
Icon="BookOpen"
Title="Catalog"
AutoScroll="true">
<Root>
<ext:TreeNode Text="Composers" NodeID="root" Expanded="true">
</ext:TreeNode>
</Root>
</ext:TreePanel>
</form>
</body>
</html>