I have the following problem. I'm using a structure (not a single table) to display my edit page.
When Im submitting my page, (an ascx page), after having filled all the fields, I fill some ModelState.Error (with ModelState.AddModelError) It is well detected by my code line "if (!ModelState.IsValid) "
However, once the Form is updated (once the line "return" of my Edit(post) is call), not any ModelErrorState are display开发者_JAVA百科ed. The same code on a form using a single table is working without any problem.
Im almost sure that the problem is coming from the way I reload my structure.
Any idea ?
Well I finally found my answer.
I was writing the following line : ModelState.AddModelError("MY_DATE_TO_FILL", "Please fill this field");
instead of the following : ModelState.AddModelError("MyClass.MY_DATE_TO_FILL", "Please fill this field");
Its working now.
精彩评论