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