HtmlHelper
案例一:在视图创建表单:
@using (Html.BeginForm("Add","Home", FormMethod.Post,new{ id="form1" })) { }
案例二:创建分部视图
@{
Html.RenderPartial("RenderPartia1");
}
或
控制器:
public class HomeController : Controller { // GET: Home public ActionResult Index() { return View(); } public ActionResult RenderPartia1() { return View(); } }
视图:
<body> <div> 我是Index <p> ********************************************</p> @{ Html.RenderPartial("RenderPartia1"); } </div> </body>
运行: