初始:
public ActionViewResult Action_ASDA(Model model)
{
...
...
return PartialView("My_Model_View",model);
}
好的..现在我需要这个函数来返回HTML代码(功能相同,但我需要以字符串形式返回HTML)
public string Action_ASDA(Model model)
{
...
...
// HTML RESPONSE
Response.Clear();
Action_ASDA(model).ExecuteResult(ControllerContext);
Action_ASDA(model).ExecuteResult(ControllerContext);
return Response.ToString().Replace("System.Web.HttpResponseWrapper", string.Empty);
}
show show“...”是模型生成和完成的代码。
答案 0 :(得分:0)
如果要返回HTML字符串,可以使用:
string html = "<div>Hello, this is div</div>";
return Content(html, "text/xml");