protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        // weonly process commands with a datasource (our image buttons)
        if (e.CommandSource == null)
        {
            return;
        }
        string typeOfControl = e.CommandSource.GetType().ToString();

        if (typeOfControl.Equals("System.Web.UI.WebControls.ImageButton"))
        {
            int         id   = 0;
            ImageButton imgb = (ImageButton)e.CommandSource;
            if (imgb.ID != "New" && imgb.ID != "Exit")
            {
                id = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][e.Item.OwnerTableView.DataKeyNames[0]];
            }
            switch (imgb.ID)
            {
            case "Select":
                break;

            case "Edit":
                break;

            case "Delete":
                aInv = (from i in ctx.AmendmentInvoices
                        where i.AmendmentInvoiceId == id
                        select i).FirstOrDefault <AmendmentInvoice>();
                if (!CntAriCli.DeleteAmendmentInvoice(aInv, ctx))
                {
                    lblMessage.Text = Resources.GeneralResource.DeleteInvoiceFailed;
                    return;
                }
                lblMessage.Text = "";
                ctx.SaveChanges();
                RefreshGrid(true);
                break;
            }
        }
    }