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 RadGrid2_ItemCreated(object sender, GridItemEventArgs e)
    {
        var editItem = e.Item as GridEditableItem;

        if (editItem != null && e.Item.IsInEditMode)
        {
            var territoryTextBox = editItem["TerritoryID"].Controls[0] as TextBox;
            territoryTextBox.Enabled = false;

            var territoryDescTextBox = editItem["TerritoryDescription"].Controls[0] as TextBox;
            territoryDescTextBox.Enabled = false;
        }
    }

    protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (!IsPostBack)
        {
            if (e.Item is GridDataItem && e.Item.ItemIndex == 0)
            {
                GridDataItem dataItem = e.Item as GridDataItem;
                dataItem.Edit = true;
            }
        }
    }

    protected override void OnPreRender(System.EventArgs e)
    {
        base.OnPreRender(e);

        if (!IsPostBack)
            RadGrid2.Rebind();
    }
    protected void RadDropDownTreeTest_DataBound(object sender, System.EventArgs e)
    {
        ((RadDropDownTree)sender).ExpandAllDropDownNodes();
    }

}
