0
public ActionResult Default()
{
ViewBag.Message = "Hello,World!";
var template = "<h1>@ViewBag.Message</h1>";
//How to make the content of the following "View" = "template"
return View();
}
然后建立HTML结果为:如何从一个字符串返回鉴于MVC3在C#
Plase帮我,谢谢!我知道RazorEngine可以解析Razor文件,但不能将字符串渲染到View。
为什么?为什么不简单地使用正确的视图?这解决了什么问题? – Oded 2013-02-08 20:37:21