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