MVC呈现局部视图没有的HttpContext或控制器上下文 [英] mvc render partial view without httpContext or controller context
本文介绍了MVC呈现局部视图没有的HttpContext或控制器上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能呈现不ViewContext或ControllerContext局部视图?
Is it possible to render partial view without ViewContext or ControllerContext?
- 我试图让PartialView HTML作为从控制器动作之外的字符串。
- 或
- 是否有可能从其他方法调用控制器动作? (这将允许我执行控制器动作,并得到部分查看HTML这种方式)。
推荐答案
您可以尝试的剃刀发电机的Visual Studio扩展。基本上,你对你的看法运行自定义工具,它会生成一个类,您可以通过一个模型转换,它会产生一个字符串。
You can try the Razor Generator Visual Studio Extension. Basically you run the custom tool on your view and it will generate a class that you can pass a model into and it will generate a string.
这篇关于MVC呈现局部视图没有的HttpContext或控制器上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文