开发者

MVC Get Control View HTML value

I was curious to see if its possible that from a controller (or else where) could I get a instance of a Control View pass it the model it requires and get back the html that it would output?

For example I have a Control View that builds a league table. This is fine for when using it on the site but I also want 开发者_如何转开发to put this league table into a html email that I send out... can I use the control view to do this or do I have to recreate the league table?


If you put the table itself in a partial view, you could easily use Html.RenderPartial() to get the output from it. If you go so far as having an action method that gets the appropriate data from your data store and returns the partial, you could even use Html.Action() (given that you use MVC2 or higher).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜