validation - Prevent MVC4 SelectList from being 'required' -


i have selectlist in razor page user should able select item or not see appropriate.

the selected item value integer property in entity framework database-first table/class , have associated buddy class meta data - there isn't significant meta data value , not required attribute. mention because i've imported system.componentmodel , system.componentmodel.dataannotations , it's possible might have bearing on things.

in razor page have:

@html.dropdownlistfor(x => x.blah, myselectlist, "(select)") 

and source code page reveals:

<select data-val="true" data-val-number="the field blah must number." data-val-required="the blah field required." ...> 

i didn't ask 'required' it's there: how inhibit it?

crispin

i think "blah" integer... required. need make blah nullable int.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -