I can bind a array (containing hierarchical data) to a treeview with no problem. I've been able to use a template when I've created the nodes programically.
I can't seem to be able to bind the array to a tree veiw that has a node template:
Error:
DataBinding: 'Telerik.Web.UI.RadTreeNode' does not contain a property with the name 'user'.
code:
I can't seem to be able to bind the array to a tree veiw that has a node template:
Error:
DataBinding: 'Telerik.Web.UI.RadTreeNode' does not contain a property with the name 'user'.
code:
<telerik:RadTreeView ID="RadTreeView1" runat="server"> <NodeTemplate> <%# DataBinder.Eval(Container, "user")%> <br /> <%# DataBinder.Eval(Container, "mess") %> <br /> <%# DataBinder.Eval(Container, "dateentry") %> </NodeTemplate> </telerik:RadTreeView> public class messages { public int id { get; set; } public int pid { get; set; } public string user { get; set; } public DateTime dateentry { get; set; } public string mess { get; set; } public messages(int i, int p, string u, DateTime dt, string m) { id = i; pid = p; user = u; dateentry = dt; if (m.Length > 300) mess = m.Substring(0, 290); else mess = m; } } ArrayList data = new ArrayList(); protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { data = (ArrayList)Session["Data4"]; } else { data = new ArrayList(); LoadData(); Session["Data4"] = data; } RadTreeView1.DataSource = data; RadTreeView1.DataTextField = "mess"; RadTreeView1.DataValueField = "id"; RadTreeView1.DataNavigateUrlField = ""; RadTreeView1.DataFieldID = "id"; RadTreeView1.DataFieldParentID = "pid"; RadTreeView1.DataBind(); } 