protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { string id = (string)GridView1.DataKeys[e.RowIndex].Value; Contents obj = new Contents(); obj.Delete(id); Response.Write("<script>window.location.reload();</script>"); } catch (Exception ex) { lblMessage.Text = ex.Message; } }