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>

运行:

 

posted @ 2018-12-01 21:05  风葬秋暝  阅读(141)  评论(0编辑  收藏  举报