So I have a drop down list that for some reason is getting the input-validation-error
class injected. When I first load the page everything loads fine on the GET request. It isn't until the form is POSTed back will it invalidate. No matter which option is selected, on the post MVC will inject the error class, and the error message will say "The value '0' is invalid". The value it displays is the value of the selection which could be any valid integer.
Here is the CSHTML:
<div class="form-group">
@Html.LabelFor(m => m.DistributionTable, "Distribution:", new { @class = "col-lg-2 control-label" })
<div class="col-lg-10">
@Html.DropDownListFor(m => m.DistributionTable, new SelectList(Model.DistributionTable, "Value", "Key", Model.Criteria.SelectedDistribution), new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.DistributionTable)
</div>
</div>
So from there you can see the drop down list is binded to a field DistributionTable that looks like this:
[XmlIgnore]
public Dictionary<string, int> DistributionTable { get; set; }
As you can see this is a Dictionary that has no attributed validation. Nor, have I added any custom validation past once it arrives in the controller.
My question is why and where is the validation error occurring, so that I can remove this validation error?
Thank you,