Skip to content Skip to sidebar Skip to footer

Asp.net Mvc 5 Html.dropdownlist Is Not Validating

I've been stuck on this problem for a while now and can't seem to find anything online that helps. I have a Html.DropDownList in an Editor Template. I use that template in my form

Solution 1:

@StephenMuecke pointed out that something looked wrong with the code, since the code seemed to be referencing the Request model rather than the Request View model.

So, I took a second look at the code and realized that the Create.cshtml was using the Request model rather than the RequestCreateViewModel.

I'm getting the correct validation errors after changing the Create.cshtml to use the RequestCreateViewModel:

@model WdcTesterManager.Models.RequestCreateViewModel

Post a Comment for "Asp.net Mvc 5 Html.dropdownlist Is Not Validating"