Posted 01 Dec 2009 Link to this post
Hi, I am wondering if anyone can offer any suggestions to resolve an problem I am having. What I am trying to do: Programmatically create the equivalent of the NodeTemplate (as follows) <telerik:RadTreeView ... <Nodes> <telerik:RadTreeNode> <NodeTemplate> some html in here.... </NodeTemplate> </telerik:RadTreeNode> </Nodes> This is an example of the server side code which programmatically adds the nodes to the tree and uses a custom NodeTemplate RadTreeNodeTemplate (see below) public class RadTreeNodeTemplate : ITemplate { private string content; public RadTreeNodeTemplate(string text) { content = text; } #region ITemplate Members public void InstantiateIn(Control container) { HtmlGenericControl nodeDiv = new HtmlGenericControl("div"); nodeDiv.Visible = true; nodeDiv.InnerHtml = content; nodeDiv.EnableViewState = true; container.Controls.Add(nodeDiv); } #endregion } } Tree building code: .... RadTreeNode node = new RadTreeNode(); node.Expanded = true; node.NodeTemplate = new RadTreeNodeTemplate(question.LibraryQuestion.ShortDescription); node.Value = question.Id.ToString(); parentNode.Nodes.Add(node); .... The problem is with the programmatically generated nodes cause client-side errors when you mouse over them when they have html content. a.RadTreeNode.prototype={set_element:function(c){this._element=c; this._element._item=this; I figure the html rendered isn’t quite correct... What should I have my RadTreeNodeTemplate (custom ITemplate) Any help would be greatly appreciated. Cheers Michael
Posted 02 Dec 2009 Link to this post