ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Child DropDown shows Validation on popup load
Title:
B
I
{code}
?
A curious case, I have a popup with three DropDown, all are Required fields and linked using Parent but when popup is showed one shows the vadation messsagge (without me pressing the OK button) see http://www.caivola.it/files/validate2.png How resolve it ?
Save Changes
Cancel
Meccanica Rossi
asked at 24 Jan 2018
the validate method is called on input change, that means that the value of that dropdown has changed, so the parent has loaded and as a result the child dropdown has loaded also and after the load the new value is different from the old one, which triggers the `change` event
at 24 Jan 2018
Omu
I do nothing, only load popup .. here the source for 2nd dropdown: View: @(Html.Awe().AjaxDropdownFor(o => o.WhereFilterType)) @Html.ValidationMessageFor(m => m.WhereFilterType)
at 24 Jan 2018
Meccanica Rossi
what's the type of `WhereFilterType` ?
at 24 Jan 2018
Omu
enum WhereFilterType { None, Equal, NotEqual, ...
at 24 Jan 2018
Meccanica Rossi
ok, so it's a value type, so it can't be `""`, it will have the default enum value, and after the parent loads it changes its value to the first item which has a different value `""` You can change the viewmodel property type to nullable `WhereFilterType?`
at 24 Jan 2018
Omu
Right !, now is ok
at 24 Jan 2018
Meccanica Rossi
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK