bootstrap
<form role="form"> <div class="form-group"> <label for="name">名称</label> <input type="text" class="form-control" id="name" placeholder="请输入名称"> </div> <button type="submit" class="btn btn-default">提交</button> </form>
MVC
@using (Html.BeginForm("Create", "User", FormMethod.Post, new { @class = "form-horizontal" })) <div class="form-group"> <label for="name">名称</label> @Html.TextBox("name", "", new { @class = "form-control", placeholder = "请输入账号" }) </div> <button type="submit" class="btn btn-default">提交</button> }
说明:
@using (Html.BeginForm("Create", "User", FormMethod.Post, new { @class = "form-horizontal" }))
Create:执行的Action
User:控制器Controller