Reputation: 12294
Is it really efficient to render HTML in cs file . i am talking about the efficiency only? Html helper approach in the mvc is the samething or not? rendering html in the cs file
Upvotes: 1
Views: 246
Reputation: 24182
You mean that you are generating the HTML inside the CS files (model, controller, etc...) and then passing it to the view, or outputting it directly via Response.Write?
If so, I don't think there are much concerns about efficiency, apart from the fact that you are sure that everything needs to be put in memory first (the server cannot output it directly). Remember to use a StringBuilder, and not just concatenating strings.
So, it's not for efficiency reasons, you should avoid this. If you are doing this, you either have very, very specific needs, or your approach to the MVC is incorrect, and you should really review it, because this is something you should NOT be doing, as you are just throwing away all the MVC pattern and advantages...
Upvotes: 1