using System;
using System.Data;
using System.Configuration;
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 _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadGrid1.UpdateCommand += new Telerik.Web.UI.GridCommandEventHandler(RadGrid1_UpdateCommand);
        RadGrid1.PreRender += new EventHandler(RadGrid1_PreRender);
        Session["CustomUpdate"] = false;
    }

    void RadGrid1_PreRender(object sender, EventArgs e)
    {
        if (IsPostBack && (bool)Session["CustomUpdate"])
        {
            RadGrid1.MasterTableView.Items[(int)Session["ItemIndex"]]["ProductID"].Text = (string)Session["ProductID"];
        }
    }

    void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        GridEditableItem item = (GridEditableItem)e.Item;
        GridEditManager manager = item.EditManager;
        GridTextBoxColumnEditor editor = (GridTextBoxColumnEditor)manager.GetColumnEditor("ProductID");
        Session["ProductID"] = editor.Text;
        Session["ItemIndex"] = item.ItemIndex;
        Session["CustomUpdate"] = true;
    }
}