using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.CodeDom;

using System.Web.Services;
using Telerik.Web.UI;
using System.Data;

partial class _Default : System.Web.UI.Page
{
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            if (!RadGrid1.MasterTableView.IsItemInserted)
            {
                GridEditFormItem item = e.Item as GridEditFormItem;
                (item.FindControl("UpdateButton") as LinkButton).OnClientClick = String.Format("MyClientClick('{0}')", item.EditFormCell.ClientID);
                (item.FindControl("CancelButton") as LinkButton).OnClientClick = String.Format("MyClientClick('{0}')", item.EditFormCell.ClientID);
            }
            else
            {
                GridEditFormInsertItem item = e.Item as GridEditFormInsertItem;
                (item.FindControl("PerformInsertButton") as LinkButton).OnClientClick = String.Format("MyClientClick('{0}')", item.EditFormCell.ClientID);
                (item.FindControl("CancelButton") as LinkButton).OnClientClick = String.Format("MyClientClick('{0}')", item.EditFormCell.ClientID);
                
            }

        }
    }
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.UpdateCommandName || e.CommandName == RadGrid.PerformInsertCommandName || e.CommandName == RadGrid.CancelCommandName)
        {
            System.Threading.Thread.Sleep(2000);
        }
    }
}








