Answer the question
In order to leave comments, you need to log in
What would you recommend for dynamic rendering of html in an ASP.NET MVC application?
Here's the deal. Razor must be used. With an async request, we get one of three statuses. And depending on this status, you need to change the content of the block without a full page refresh. React requires a complete abandonment of the Razor engine, as far as I understand it. Summing up, what to use to painlessly dynamically change the contents of the modal window elegantly? PS. I am a backend developer far from the new front trends. Please help, preferably with code example. Thanks
Answer the question
In order to leave comments, you need to log in
You can't do a single page on razor, because razor is server-side rendering. You can not use React, but you can't do without js. With Ajax, request a partial view and insert the result into the modal window block.
In code it will look like this
$.ajax({
type: "POST",
url: window.baseUrl + "Controller/Action",
data: params,
success: function (result) {
if (result) {
$(".modal").html(result);
}
})
public ActionResult Action(IncomingParameters params)
{
var model = Anything(params);
return PartialView("Action", model);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question