asp.net mvc - MVC Model Binding -


I am using the MVC verification library. I chose this library because I am using NetSets, Enterprise Library generates all the assumptions using the validation blocks.

It works fine that the model binding itself is validating the object and is populating the validation summary. I believe in general practice

  [Accept Wierbes (HTV.bybs.post)] Public Action Result Register ([Bind ()] Nettseerobase Obze (Return View); }  

There is also a method in the verification libraries, which is documented as follows:

  [AcceptVerbs (HttpVerbs.Post)] Public Action Register ([Bind ()] NetTiersObject obj {try {obj.Validate & lt; NetTiersObject & gt; (); } Hold (EntityValidationException ex) {ViewData.ModelState.PopulateWithErrors (ex); } See Return (); }  

It also works fine.

My problem is that when using the verification library method, this error message duplicates. When using just the error message binding model weird appears errors have the property name in the message.

Therefore, I think that I should format model binding error messages or disable the model binding altogether.

Any recommendation, assistance?

Thank you.

Have you tried:

  / * Model at the point Status must be valid (true) because we have not yet implemented any assumptions * / var v = ModelState.IsValid; Try {obj.Validate & lt; NetTiersObject & gt; (); } Hold (EntityValidationException ex) {ViewData.ModelState.PopulateWithErrors (ex); }  

and check that v is true, it should be. If this is true, then obj.Validate & lt; NetTiersObject & gt; (); Something is doing wrong because its only errors are repeated.

My problem is that the method of verification library duplicates this error message. When simply using the error message binding model appears weird, the errors in the error are the names of the names.

This is strange because the modelbading model should not populate errors, at least if you are not using custom model binding or trying to save the field without validating db .


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -