protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex]; Label lbldeleteid = (Label)row.FindControl("lblID"); bl.cust_id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()); dl.delete_comapny(bl); ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('Delete Successfully'); window.location='company_list.aspx';", true); grid(); } catch (Exception ex) { } }