To call a method in mvc4.0 we can do it by using jquery ajax
$(document).ready(function () {
$("#btnCreate").click(function () {
$.ajax({
type: "GET",
url: '@Url.Action("GetRecords", "Status")',
data: { strStatusValue: value },
success: function (data) { },
error: function (error) {
$(".loading").hide();
}
})
});
});
Note : Here i am getting value from from data "strStatusValue". using that we will get the records based on the value.
[HttpPost]
public JsonResult GetDetailsUsingId(string strEmailId)
{
DataSet ds = new DataSet();
string procedureName = "getUserDataAccessTabs";
SqlParameter[] Params = new SqlParameter[1];
Params[0] = new SqlParameter("@userId", strEmailId);
ds = DataAccess.SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, procedureName, Params);
return Json(ds , JsonRequestBehavior.AllowGet);
}
the above method will return the record based on "strStatusValue".
Here i used jquery ajax for partial rendering in the click event.
$(document).ready(function () {
$("#btnCreate").click(function () {
$.ajax({
type: "GET",
url: '@Url.Action("GetRecords", "Status")',
data: { strStatusValue: value },
success: function (data) { },
error: function (error) {
$(".loading").hide();
}
})
});
});
Note : Here i am getting value from from data "strStatusValue". using that we will get the records based on the value.
[HttpPost]
public JsonResult GetDetailsUsingId(string strEmailId)
{
DataSet ds = new DataSet();
string procedureName = "getUserDataAccessTabs";
SqlParameter[] Params = new SqlParameter[1];
Params[0] = new SqlParameter("@userId", strEmailId);
ds = DataAccess.SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, procedureName, Params);
return Json(ds , JsonRequestBehavior.AllowGet);
}
the above method will return the record based on "strStatusValue".
Here i used jquery ajax for partial rendering in the click event.
No comments:
Post a Comment