I am working on mvc4 project.I am using Dexexpress grid. What i want to do is when i click on add .. i do ajax call to check if user is in database..if not its saved into database and .. and i am returning paritial view of grid to refresh grid with latest data.
But i want to return some value too along with gridview partial.. so that i can show whther that user is already added or not.
Eg : Jquery code for ajax call
function AddUser() {
showProgress();
$.ajax({
url: 'ManageUsers/AddUsers/?id=' + Math.random(),
data: $("#frmManageUsers").serialize(),
type: 'Post',
datatype: 'json',
success: function (data) {
if (data != '') {
$("#grid").html('');
$("#grid").html(data);
}
else
alert('No Record Found');
},
error: function (request, status, error) { ShowErrorMessage(); },
complete: function () { hideProgress(); ShowSuccessMessage(); }
});
}
and controller
public ActionResult AddUsers(Usertable model)
{
int successid = ManageUserExecutor.Save(model);
if (successid == -1)
{
List<usp_GetListOfUsers_Result> objList = new List<usp_GetListOfUsers_Result>();
return PartialView("GridViewPartial", objList);
}
else
return RedirectToAction("GridViewPartial");
}
What i want is if i can get value of successid in ajax retrun along with gridview partial html ... so that i can display message according to that..