On the Page_Load the Attribute IS set correctly.
So that on NodeExpand of the top level the myPC node is created.
However, the Attributes.Add in NodeExpand does not set the attributes.
Therefore NEXT time it comes into expand, Drive node is NOT created.
Is this a bug?
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!Page.IsPostBack) |
{ |
RadTreeNode rootNode = new RadTreeNode("Computers"); |
rootNode.Attributes.Add("type", "ROOT"); |
rootNode.Value = "ROOT"; |
rootNode.ImageUrl = "~/TreeView/Img/WindowsXP/6myNetworkPlaces.gif"; |
rootNode.Expanded = true; |
rootNode.ExpandMode = TreeNodeExpandMode.ServerSideCallBack; |
RadTreeView1.Nodes.Add(rootNode); |
} |
} |
protected void RadTreeView1_NodeExpand(object sender, RadTreeNodeEventArgs e) |
{ |
if (e.Node.Attributes["type"] == "ROOT") |
{ |
RadTreeNode node = new RadTreeNode("mypc"); |
node.Attributes.Add("type", "COMPUTER"); |
node.Value = "COMPUTER"; |
node.ImageUrl = "~/TreeView/Img/WindowsXP/2PCRemote.gif"; |
node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack; |
e.Node.Nodes.Add(node); |
return; |
} |
if (e.Node.Attributes["type"] == "COMPUTER") |
{ |
RadTreeNode node = new RadTreeNode("C"); |
node.Attributes.Add("type", "DRIVE"); |
node.Value = "DRIVE"; |
node.ImageUrl = "~/TreeView/Img/WindowsXP/15hardDisk.gif"; |
node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack; |
e.Node.Nodes.Add(node); |
} |
} |