
I have a grid with row validation and row details. Now I experience the problem that the RowValidating-event is not raised when the user changed something in the row details. In my case, I have a check box whose IsChecked property is data-bound to a property of the row's item. The problem occurs with "internal" row details as well as with an "external" DetailsPresenter.
How can I get the GridView to raise the RowValidating-event in this case?
many thanks,
Andreas
13 Answers, 1 is accepted
RowDetails are defined by the developer (in this case you) and they work directly on the corresponding business object (the DataContext of each GridViewRow, i.e. each data item).
In this aspect RowDetails are really "external" for RadGridView because we don't know what are you going to place inside them. Only values edited through GridViewCells undergo validation, because GridViewCells are our classes (Telerik's). RowDetalsTemplate on the other hand may contain *anything* -- grids, tree-views, third-party controls, anything that can be placed inside a Silverlight DataTemplate, you name it, since RowDetails is defined by you and we have absolutely no clue about what is inside.
We simply set the correct DataContext on the DetailsPresenter control hosting your template so that the Bindings you have defined inside your RowDetailsTemplate will work on the respective data item. Having cleared this out, if you need validation inside the RowDetails template, it is up to you to provide it, since we have no idea about what will be inside the DataTemplate you have created.
I hope I managed to explain the whole mechanism. Please, let me know if I could not.All the best,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

My intent was to create a Master-Detail scenario, where the grid (master) only allows navigation to
the next item (change the child), when the row'sitem validates.
Please let me know if there is an easy way to achieve this using the row validation or another mechanism.
- Andreas
In this case you can place another RadGridView inside the RowDetailsTemplate and let this child grid validate the child items. I have explained how to achieve this in my blog post How To: Display Hierarchical Data with Row Details (RadGridView for Silverlight). I hope this helps.
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

You mention that you have a DataForm inside the RowDetailsTemplate. Probably you should attach to one of its events like ItemEditEnding, ItemEditEnded, ValidatingItem, or LostFocus and do the house keeping there.
You may also try attaching to RadGridView's RowDetailsVisibilityChanged event. When you select a new row and the row details of the old row become invisible this event will be fired twice. The first time it will be fired for the row details that are being hidden. You can read this information from the EventArgs. The second time it will be fired for the new row details that become visible. You can read that from the EventArgs as well. Again, I am not sure that this event will not be too late for the DataForm, which is another reason to try to resolve the issue with one of the DataForm's events.
Even if we hypothetically create the event that you want -- it will be "too late" like the SelectionChanged event, so this will not help at all.
Using this event might help you, but in my opinion it should be the DataForm that has to be aware that it is losing focus and do the housekeeping.
If you place the same DataForm in something completely different from RadGridView, then how would you handle this same issue? Take RadGridView out of the picture and imagine that the DataForm is losing its focus for some reason. How would you handle the validation errors?
When your DataForm validation fails, you can return back to its parent row by setting the SelectedItem of the grid.
Also, you may have another option call Async Validation, which is described in great detail in this and this blog post. This is just an idea.
As for your second questions, here is an article that describes how to locate things inside the row details.
I hope this helps.
Best wishes,
Ross
the Telerik team



I totally understand your problem. There already is the same feature request and you can vote for it. Meanwhile, you can try to do something with handling the raw mouse events (after all -- they occur before anything else) when rows are being clicked, but I am not sure whether this will be trivial. To tell you the truth I really think that this will be an overkill.
As for the external DetailsPresenter, you can use Telerik's extension method ChildrenOfType<T> and find your control that is inside it by its type. Another alternative is to use the fact that the DetailsPresenter is in fact a ContentControl. The thing that was created by loading your RowDetailsTemplate will actually be the Content of this ContentControl. So if you place your own user control in the row details template, you can then cast the DetailsPresenter.Content to this type and do anything with it -- like find one of its children.
I hope this helps.
Best wishes,
Ross
the Telerik team

We will do our best to implement this as soon as possible. Please, excuse us for the inconvenience that this might be causing you.
Regards,
Ross
the Telerik team

Indeed you cannot call row validation method from outside. We will reconsider this case, but I cannot commit that we will make it possible.
However there is a simple workaround. All row related editing events like RowValidating, RowValidated and RowEditEnded are thrown for the row in edit mode (so you need row in edit mode you will recognize it with a small edit indicator at the beginning of the row) and a current cell inside this row. Row events will get fired when current cell is moved to another row. Note that it is not necessary initial current cell to be in edit mode (if it is in edit mode also cell related editing events will be raised).
Let me know if this doesn't help.
Nedyalko Nikolov
the Telerik team