У меня есть вид с кнопкой отправки.Он имеет несколько элементов управления, многие из которых являются DropDownLists.В классе «Моя модель» у меня есть только определенные свойства, которые необходимы.Моя страница не будет отправлена до тех пор, пока не будут выбраны все мои выпадающие списки, она требует дополнительных элементов управления, когда я не хочу их.Любая идея, почему это?Вот код, который у меня есть.(Это заставляет меня иметь тип программного обеспечения, источник и производителя)
//Model
[Required]
[Display(Name = "Part Book / Category")]
public string PartBook { get; set; }
//decimal
public string PartNextNumber { get; set; }
[Display(Name = "Today's Date")]
public DateTime DateEntered { get; set; }
[Required]
[Display(Name = "Entered By")]
public int EnteredBy { get; set; }
[Display(Name = "Software Type")]
public int SoftwareType { get; set; }
//unsure of this one ********************
[Display(Name = "Assembly Number")]
public string UsedOnAssembly { get; set; }
// INT OR BOOL ?
[Display(Name = "Global Part")]
public bool GlobalPart { get; set; }
//[Required]
public int Source { get; set; }
public int Manufacturer { get; set; }
[Display(Name = "Manufacturer Part Number")]
public string ManufacturerPartNumber { get; set; }
//View
t-danger" })
<div class="panel-body">
<div class="col-md-6 col-lg-6">
@* Change to DropDownList of ParkBooks *@
@*@onchange="location.href='"+
Url.Action("DoPartBookFunc","Parts", "parkbookDDL")+"'" *@
@Html.DropDownListFor(x => x.PartBook,
(IEnumerable<SelectListItem>) ViewBag.PartBookDDL,
"", new { @class = "form-control" })
@Html.ValidationMessageFor(x => x.PartBook,
"", new { @class = "text-danger" })
</div>
<div class="form-group row">
<div class="col-md-3 col-lg-3">
@Html.LabelFor(x => x.SoftwareType,
htmlAttributes: new { @class = "control-label" })
</div>
<div class="col-md-6 col-lg-6">
@Html.DropDownListFor(x => x.SoftwareType,
(IEnumerable<SelectListItem>)ViewBag.SoftwareTypeDDL,
"", new { @class = "form-control" })
@Html.ValidationMessageFor(x => x.SoftwareType, "",
new { @class = "text-danger" })
</div>
<div class="form-group row">
<div class="col-md-3 col-lg-3">
@Html.LabelFor(x => x.Source,
htmlAttributes: new { @class = "control-label" })
</div>
<div class="col-md-9 col-lg-9">
@Html.DropDownListFor(x => x.Source,
(IEnumerable<SelectListItem>) ViewBag.SourceDDL,
"", new { @class="form-control" })
@Html.ValidationMessageFor(x => x.Source,
"", new { @class = "text-danger" })
</div>
</div>
<div class="form-group row">
<div class="col-md-3 col-lg-3">
@Html.LabelFor(x => x.Manufacturer,
htmlAttributes: new { @class = "control-label" })
</div>
<div class="col-md-6 col-lg-6">
@Html.DropDownListFor(x => x.Manufacturer,
(IEnumerable<SelectListItem>)ViewBag.ManufacturerDDL,
"", new { @class="form-control" })
@Html.ValidationMessageFor(x => x.Manufacturer,
"", new { @class = "text-danger" })