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 Default : System.Web.UI.Page
{
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        RadGrid2.ItemDataBound += new GridItemEventHandler(RadGrid2_ItemDataBound);
    }

    void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = e.Item as GridDataItem;
            item["GridDropDownColumn"].Text = (item.DataItem as DataRowView).Row["TitleOfCourtesy"].ToString();
        }

        if (e.Item.IsInEditMode && e.Item is GridEditableItem)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            GridEditManager editMan = editedItem.EditManager;
            GridDropDownListColumnEditor editor = editMan.GetColumnEditor("GridDropDownColumn") as GridDropDownListColumnEditor;

            if (editor != null)
            {
                var data = new[] { new { TitleOfCourtesy = "Ms." }, new { TitleOfCourtesy = "Mrs." }, new { TitleOfCourtesy = "Dr." } };
                editor.DataSource = data; //LBOffice.Website.Language.GetBusinessAreas(Session["language_path"].ToString());

                editor.DataBind();

                //if (dfCompany != null)
                editor.SelectedValue = (e.Item.DataItem as DataRowView).Row["TitleOfCourtesy"].ToString(); //dfCompany.BusinessAreaKey;
            }
        }
    }
}
