//GridFund_ItemCommand event is use for two command name edit and delete protected void GridFund_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { string EnvelopedNumber, DID; //if command name is EditDonation donation it will get the id of particuar //row to edit the donation and redirecte it to newdonation screen to update that donation if (e.CommandName == "EditDonation") { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; EnvelopedNumber = (item["Envelopenumber"].Text.ToString()); DID = item["DID"].Text.ToString().Trim(); Response.Redirect("~/UserScreens/NewDonation.aspx?DID=" + DID); } } //If command name is delete it will get the id that donation which needs to be deleted by calling DELETEDonation //it will successfully get deleted else if (e.CommandName == "Delete") { GridDataItem item = (GridDataItem)e.Item; objd.Envelopenumber = (item["Envelopenumber"].Text.ToString()); objd.FundName = (item["FundName"].Text.ToString()); no_of_rows_affected = objd.DELETEDonation(); if (no_of_rows_affected == 1) { Validations.showMessage(lblErrorMsg, "Donation " + Validations.RecordDeleted, ""); BindGrid(); } else { Validations.showMessage(lblErrorMsg, "Donation " + Validations.Err_RefDelete, "Error"); } } }