Hi,
Using MVVM and RIA I've managed to put the client side validations to work in RadGrid with great success.
In some features that I think that are missing (but I hope that will be available in nerar future :)) I'm impplementing some workarounds to do that (allow inserting rows in middle, insert rows after TAB key on the last cell , move rows, etc.).
Yet, I dont like to do that because of two reasons :
- You kow much bether the component so your impplementation will be certanly bether than my own.
- Wen you impplement those, I'll need tho change my code to use your impplementation.
So, that's the reason I ask the next questions :
I'm trying to figure out a way to manage properly the validation errors that come back from RIA on SubmitChanges.
Let me explain the problem :
- Using the radgridview the user will adds, deletes,modifies lots of rows all of them validated on client side.
- On submit, some of the rows could have validation errors (the other error types I'll think about it later).
- So, in my Entityset, wrapped in a RadObservableCollection, some entities will have ValidationErrors filled, yet only when I edit (F2) the item in radgridview the error is displayed.
- And if multiple entities has errors ?
I've thinked about a couple of solutions, but none of them with a good user experience.
I' would like if the radgrid could have the validation errors even in display (non edit) mode.
Do you have any recommendation for impplement this ?
Thanks ,
Joao
6 Answers, 1 is accepted
The best approach would to ensure that no validation error are thrown when you submit the changes - use client side validation to ensure that all data is correct before SubmitChanges is called. Depending on the specific scenario that could very easy or a bit hard.
The other solution is to subscribe for SubmittedChanges of the DomainDataSource and manually edit all invalid data items until they become valid.
Kind regards,Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thank you for your responce.
"The best approach would to ensure that no validation error are thrown when you submit the changes"
Still, this solution is not possible for some of my cases basically because I cannot ensure that.
Let me explain a scenario :
I have a warehouse and in it I have a lot of products. I need to sell this products but I must ensure the product availability. For this, when I submit the changes, an server routine is called and returns, for each line, if it succeeds (Yes, I've stock and your line is saved) or fails (I don't have stock enought).
I cannot use your sugestion because I can validate the availability and it succeeds and 1 second after I call save changes and meanwhile the product availability became zero, so I cannot sell it.
I've managed put to work all of the steps, RIA services already replies to client with a list of entities with validation errors when I submit changes. But I cannot "display" this validation all "error" entities at once. In fact, i've used a small trick that is creating a "error label" in each row that is visible only when the entities has validation errors comming from submitchanges. Yet, it's a trick, and I don't like it manly because is not the "standard" validation.
Attached is a draw of i need to accomplish.
Any sugestion ?
Thanks,
Joao Rodrigues
I now understand your scenario. Unfortunately at the moment RadGridView is incapable of displaying validation error cues for many items. For the time being your custom implementation of error cues is the only available option.
We are working hard to provide such built-in functionality but it is still unknown when we will be able to introduce this functionality.
Best wishes,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
My question was manly to check if this functionality already exists or if there was already a "best/recomended way" to implement this kind of requirement. Since it not exists, I'll keep my custom impplementation.
Yet, in my oppinion, such built-in functionality would be great.
Thanks,
Joao
Hello Marco Barzaghi,
We have done many improvements to your validation mechanism in the past several months. Now, as long as your data entities support INotifyDataErrorInfo the grid will correctly display error cues for entities that have errors. More information about this can be found here.
Hope this helps.
Greetings,
Milan
the Telerik team