EF -> RIA Services -> Silverlight, Can I show validation error messages but still Save changes
I am using Entity Framework 4.0, RIA Services, and Silverlight 4.0. I need the user to be able to save any changes regardless if they are correct or incomplete. To do this I had to make a lot of fields in the database nullable. I still want to be able to show validation error messages in the Silverlight client to the user. What I would like to do is use DataAnnotations to attribute the entities metadata in Ria Services to get the nic开发者_JAVA技巧e validation error messages on the client but I need the user to be able to save even if it breaks validation. Is this possible? How would I go about implementing this?
Thanks, Evan
In Silverlight there is no such thing as warnings-only Data Annotation Validators. In ASP.NET you could get your intended outcome using a CustomValidator that was simply client-side JavaScript, but no such equivalent is present in Silverlight. Your best bet is to program this logic into the form itself or create a custom control which allows you to decorate an existing control much in the way that the ToolTipService works.
精彩评论