Inject Html Into a View Programmatically

Posted by madcapnmckay on Stack Overflow See other posts from Stack Overflow or by madcapnmckay
Published on 2010-05-23T07:36:12Z Indexed on 2010/05/23 7:40 UTC
Read the original article Hit count: 278

Filed under:
|

Hi,

I have a tricky problem and I'm not sure where in the view rendering process to attempt this. I am building a simple blog/CMS in MVC and I would like to inject a some html (preferably a partial view) into the page if the user is logged in as an admin (and therefore has edit privileges).

I obviously could add render partials to master pages etc. But in my system master pages/views are the "templates" of the CMS and therefore should not contain CMS specific <% %> markup. I would like to hook in to some part of the rendering process and inject the html myself.

Does anyone have any idea how to do this in MVC? Where would be the best point, ViewPage, ViewEngine?

Thanks,

Ian

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc