ASP.NET MVC2 - 渲染视图,作为字符串 [英] ASP.NET MVC2 - Render a View as a String

查看:143
本文介绍了ASP.NET MVC2 - 渲染视图,作为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何渲染视图从控制器MVC 2字符串?

How do you render a view as a string from a controller in MVC 2?

在MVC 1中,我使用 CaptureActionHtml 。我与它有同样的问题类似的问题,但有没有办法做到这一点没有<一个href=\"http://stackoverflow.com/questions/32640/mocking-asp-net-mvc-controller-context\">Rhink.Mocks?

In MVC 1, I used CaptureActionHtml. I'm having the same problem with it as a similar question, but is there a way to do this without Rhink.Mocks?

推荐答案

我发现了一些从评论通过Bobasoft在的 http://www.brightmix.com/blog/renderpartial-to-string-in-asp-net-mvc/ 链接到<一个href=\"http://msug.vn.ua/blogs/bobasoft/archive/2010/01/07/render-partialview-to-string-asp-net-mvc.aspx\" rel=\"nofollow\">http://msug.vn.ua/blogs/bobasoft/archive/2010/01/07/render-partialview-to-string-asp-net-mvc.aspx.

I found something that works from a comment by Bobasoft at http://www.brightmix.com/blog/renderpartial-to-string-in-asp-net-mvc/ linking to http://msug.vn.ua/blogs/bobasoft/archive/2010/01/07/render-partialview-to-string-asp-net-mvc.aspx.

这篇关于ASP.NET MVC2 - 渲染视图,作为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆