Raj maddala

Raj maddala

  • NA
  • 12
  • 571

i need to call a csharp(code benind ) function using js

Mar 5 2018 4:43 AM
i have a csharp method which is updating  the database and it should be called in javascript function .
 this is code behind 
public void storeprogress()
{
con.Open();
cmd.CommandText = "update mytable  set Progress='" + progress + "' where [Registered]='" +DropDownList1.SelectedValue.ToString() + "'and [EmployeID]='" + Label1.Text.ToString() + "' ";
cmd.Connection = con;
cmd.ExecuteNonQuery();
con.Close();
}
 
and js
function InsertProgress() {
$.ajax({
type: "POST",
url: 'NewVideosPage.aspx/storeprogress',
data: "",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert("I am working ");
},
error: function (e) {
alert("Something Wrong.");
}
});
}
 

Answers (3)