Hi folks hi have a very interesting situation.
i have a viewmodel that requires a mediatype from a dropdownlist *by the way the dropdownlist is generated by
@Html.DropDownListFor(m => m.MediaType, Model.MediaTypeList)
and when i fill the form by hand all the values of the form are ok and the functions works the way it should.
but then i implemented a jquery function to set the value of the dropdownlist whenever you upload a file it detects automatically what media type it has.
function setValueToDropDown(media){
$('#MediaType').attr('disabled','');
var value = media;
$('#MediaType').val(value);
}
and when i submit the domain validations tell me that the field is required, even when the dropdownlist is option is selected and when i execute a function in console to verify the value it is different than null.
alert($('#MediaType').val())
so i dont understand why when im assigning the value to the dropdown dynamically mvc doesnt recognize it. i look everywhere and i cant find the problem.
valuethe proper value of the option you want to select? Or it rapresent the test in that option?