日期:2014-05-17 浏览次数:20492 次
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MvcApplication2.Controllers { public class DefaultController : Controller { // // GET: /Default/ public ActionResult Index() { return View(); } public HtmlString GetStr() { string str = "<p>21312</p>"; return new HtmlString(str); } } }
@using MvcApplication2.Controllers @model DefaultController @{ ViewBag.Title = "Index"; } <h2>Index</h2> @Model.GetStr()
@{Html.RenderAction("动作名", "控制器名");}
------解决方案--------------------
@{Html.RenderAction("GetStr", "Default");}