ASP.NET CORE - 表单控件学习

文本框

cshtml

<div class="form-group">
    @Html.LabelFor(model => model.RJob, "职位名称", htmlAttributes: new { @class = "control-label col-md-2" })
    <div class="col-md-8">
        @Html.EditorFor(m => m.RJob, new { htmlAttributes = new { @class = "form-control" } })
    </div>
</div>

html

<div class="form-group">
    <label class="control-label col-md-1">发布用户</label>
    <div class="col-md-2">
        <input type="text" class="form-control" value="@Model.User" readonly="readonly" />
    </div>
</div>

 

 

 

下拉选择列表

cshtml(要设置默认选项必须使用有For的这种类型)

<div class="form-group">
    @Html.LabelFor(model => model.BCheckState, "审核状态", htmlAttributes: new { @class = "control-label col-md-2" })
    <div class="col-md-8">
        @Html.DropDownListFor(model => model.BCheckState, VerifyHelper.CheckStateEditSelect(Model.BCheckState), new { @class = "form-control" })
    </div>
</div>

cshtml2

<div class="form-group">
    <p>课程类型:</p><p>
        @Html.DropDownList("StudenttypeId", null, new { @class = "form-control" })

        @Html.ValidationMessageFor(model => model.StudenttypeId, "", new { @class = "text-danger" })
    </p>
</div>

 

 

 

 

2

posted @ 2018-12-18 12:00  德丽莎·阿波卡利斯  阅读(163)  评论(0编辑  收藏  举报