c# – Asp.Net MVC Razor BootStrap输入表

目前我有一个这样的输入表单:

<div class="editor-label">
            @Html.LabelFor(model => model.VenueID)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.VenueID)
            @Html.ValidationMessageFor(model => model.VenueID)
        </div>

我想将其转换为使用以下引导代码:

<div class="form-group">
      <label for="inputVenueID" class="col-lg-2 control-label">Venue ID</label>
      <div class="col-lg-10">
        <input type="text" class="form-control" id="inputVenueID" placeholder="VenueID">
      </div>
    </div>

我该怎么做,以便我仍然可以使用HTML.LabelFor / EditorFor / ValidationMessage等相同的Razor语法?

<div class="form-group">
    @Html.LabelFor(model => model.VenueID, new { @class = "sr-only", @for = "txtVenueID" })
    @Html.TextBoxFor(model => model.VenueID, new { @class = "form-control", @placeholder = "ID:" , @id="txtVenueID" })
    @Html.ValidationMessageFor(model => model.VenueID)
</div>
翻译自:https://stackoverflow.com/questions/23353824/asp-net-mvc-razor-bootstrap-input-form

转载注明原文:c# – Asp.Net MVC Razor BootStrap输入表