public ActionResult Index()
{
return View("ViewName"); // cshtml file name
}
这是正常的作品。渲染字符串作为剃刀cshtml
public ActionResult Index()
{
string razor = "<p>Date: @DateTime.Now</p>";
return View(razor);
}
我可以这样做吗?不渲染.cshtml文件,呈现字符串,...
- 编辑------
其实我编程方式创建.cshtml文件。例如,我会在我的字符串中使用@ Html.TextBoxFor(...)或foreach语句。 - ED刚才编辑
我实际上以编程方式创建.cshtml文件。例如,我会在我的字符串中使用@ Html.TextBoxFor(...)或foreach语句。 – 2012-02-24 13:57:42