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 WebUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink");
            editLink.Attributes["href"] = "#";
            editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"], e.Item.ItemIndex);
        }
    }

    protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
    {

    }

    protected void SelectDataItemByID(int id)
    {
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
        {
            if (id == (int)item.GetDataKeyValue("EmployeeID"))
                item.Selected = true;
        }
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        if (RadGrid1.SelectedItems.Count > 0)
        {
            SelectedItemLabel.Text = "You selected EmployeeID " +
                                     RadGrid1.SelectedItems[0].OwnerTableView.DataKeyValues[RadGrid1.SelectedItems[0].ItemIndex]["EmployeeID"].ToString();

        }
        else
        {
            SelectedItemLabel.Text = "None Selected";
        }
    }

}
