ASP.net MVC: Getting a Partial View's HTML from inside of the controller

Posted by Harry on Stack Overflow See other posts from Stack Overflow or by Harry
Published on 2008-11-13T02:53:54Z Indexed on 2010/05/15 7:24 UTC
Read the original article Hit count: 251

I have developed a simple mechanism for my mvc website to pull in html via jquery which then populates a specified div. All is well and it looks cool.
My problem is that i'm now creating html markup inside of my controller (Which is very easy to do in VB.net btw) I'd rather not mix up the sepparation of concerns.

Is it possible to use a custom 'MVC View User Control' to suit this need? Can I create an instance of a control, pass in the model data and render to html? It would then be a simple matter of rendering and passing back to the calling browser.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about view-user-control