简体   繁体   中英

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 nice 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM