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

public partial class pages_AspGrid_ClientInsertUpdateDeleteDataKeyValue : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Notes.EditModes = EditModes.Design;
        RadGrid1.SelectedIndexes.Add(0);
    }

    protected void RadGrid1_DataBound(object sender, EventArgs e)
    {
        GridDataItem selectedItem = RadGrid1.Items[0];

        EmployeeID.Text = selectedItem["EmployeeID"].Text;
        FirstName.Text = selectedItem["FirstName"].Text;
        LastName.Text = selectedItem["LastName"].Text;
        Title.Text = selectedItem["Title"].Text;

        TitleOfCourtesy.FindItemByText(selectedItem["TitleOfCourtesy"].Text).Selected = true;
        BirthDate.SelectedDate = DateTime.Parse(selectedItem["BirthDate"].Text);

        Notes.Content = selectedItem["Notes"].Text;
    }

    protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
        if (e.Column.IsBoundToFieldName("BirthDate"))
        {
            ((GridBoundColumn)e.Column).DataFormatString = "{0:MM/dd/yyyy}";
            ((GridBoundColumn)e.Column).Display = false;
        }
        else if (e.Column.IsBoundToFieldName("Notes"))
        {
            e.Column.Visible = false;
        }
    }
}
