Reputation: 582
I have started using MVC 4 - razor.
In that, I have found some ways to render HTML on some action.
I have tried all three ways in my application and all are working properly.
But which is the best way to use in terms of complex/heavy HTML or large data and performace?
Upvotes: 1
Views: 564
Reputation: 5469
Depends on your requirement, i usually go for
solution 1, for initial view rendering with ActionResult(ViewResult) with razor view benefiting from @html extensions.
solution 2 can be sent as ContentResult as it is more "text/html" than "application/json".
solution 3 works very well for dynamic html in ajax calls, incorporation with some template engine like handlebar or jquery.tmpl which can be used to render substantial amount of html with a very thin json payload.
hope this helps.
Upvotes: 4