Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 23, 2012 12:32 AM by Decker Dong - MSFT
Nov 05, 2012 08:15 AM|LINK
In the context_SavingChanges method of my partial metadata class I am doing custom validations which throw a ValidationException.
Now it occurs to me that when this validationException is thrown it resets all the form fields.
When I however use for example the Required attribute on a field and I do not fill it on on purpose it will show the errorMessage that I gave the attribute, but it does not clear the form fields.
Anyone got an idea?
Thanks in advance,
Nov 06, 2012 12:17 AM|LINK
If necessary, please show us your codes.
Nov 06, 2012 09:58 AM|LINK
Hi Yannick, I'm sure the reason they get reset when you throw a validation exception in the data model is because the page gets a full refresh. But the reason the do not get reset with the required field and any of the other standard validators is because
the validation is being run on the client.
There may be a way to pass the entity values back to the page in the exception somehow, but I'm not sure.
Nov 08, 2012 01:13 PM|LINK
Good to see you're still on this forum :)
Do you have any sample on how this is normally done?
Kind regards and thanks in advance,
Nov 08, 2012 10:06 PM|LINK
Hi Yannick, I'm thinking :)
Nov 22, 2012 08:22 AM|LINK
Hey Steven, still thinking? ;P :D
Nov 22, 2012 09:41 AM|LINK
I still can't think of a way of doing this sorry.
Nov 23, 2012 12:32 AM|LINK
Or just use attributes applied on the public properties, or write your own methods to be instead of partial methods.