using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

public partial class TelerikWebForm : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
    {
        TextBoxTemplate template = new TextBoxTemplate();
        template.InstantiateIn(e.Node);
    }
    class TextBoxTemplate : ITemplate
    {
        public void InstantiateIn(Control container)
        {
            Label label1 = new Label();
            label1.ID = "ItemLabel";
            RadTreeNode rtn =(RadTreeNode) container;
            label1.Text = rtn.Text;
            label1.Font.Size = 10;
            label1.Font.Bold = true;
            label1.DataBinding += new EventHandler(label1_DataBinding);
            container.Controls.Add(label1);
        }

        private void label1_DataBinding(object sender, EventArgs e)
        {
            Label target = (Label)sender;
            RadTreeNode node = (RadTreeNode)target.BindingContainer;
            string nodeText = (string)DataBinder.Eval(node, "Text");
            target.Text = nodeText;
        }
    }
}
