I’m using a partial view in my program. How can i assign this partial to a value tuple and passing to my views in asp.net mvc 5?
this is my code but doesn’t work
my controller
var op = checkBook.DeleteCheckDetail(detailToken, param.CheckBookToken);
if (op.Success)
{
var checkDetail = checkBook.GetCheckDetail(detailToken).ToList();
var partial = PartialView("Partial/CheckDetailList/_Default",checkDetail);
var T = Tuple.Create(op, partial);
return Json(T)
}
return Json(op);
my view
$.ajax({
url: sendingUrl,
type: "POST",
data: model,
processData: false,
contentType: false,
success: function (result) {
if (result.Item1.Success) {
$("#checkDatailList").html(result.Item2);
toastr.success(result.Item1.Message);
}
else {
toastr.warning(result.Item1.Message);
}
},
2
Answers
I had to render the partial page.
And RenderViewToString Is :
You can use this:
Controller:
View: