-4
下面的HTML代碼中發現Index.cshtml--如何提高HTML使用剃刀HTML輔助
<select data-val="true" data-val-required="Please choose your country "
id="Country" name="Country" class="form-control" style="width: 200px;" >
<option value="">-- Select Country --</option >
@foreach (var country in (List<Country>)ViewBag.AvailableCountries)
{
<option value="@country.Id">@country.Name</option >
}
</select>
<span class="field-validation-valid text-danger" data-valmsg-for="Country "
data-valmsg-replace="true"></span>
請提高運用剃刀HTML輔助的HTML,如DropDownListFor
和 ValidationMessageFor
。
請改善你所要求的...,只需使用DropDownListFor。如果你問如何使用DropDownListFor,然後問... – Seabizkit