[WebMethod] public static void DeleteRec(string DeleteRecord1) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["strcon"].ConnectionString); if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("delete from tbl_Login where userID=2", con); cmd.ExecuteNonQuery(); return; }
<script> function DeleteRec(DeleteRecord1) { $.ajax({ type: "POST", url: "frmNewRegisteration.aspx/DeleteRec", data: '{DeleteRecord1: ' + DeleteRecord1 + '}', contentType: "application/json; charset=utf-8", dataType: "json", success: function () { alert("delete succesful"); }, error: function (response) { alert("unable to delete"); } }); }; </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)