This is a migrated thread and some comments may be shown as answers.

Any decent way to validate errors?

1 Answer 23 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Espen
Top achievements
Rank 1
Espen asked on 07 Sep 2011, 04:04 PM
Basically I want to use some xaml similar to this to feed validation errors in the grid into my viewmodel.
<Grid>
<i:Interaction.Triggers>
<ei:PropertyChangedTrigger Binding="{Binding (Validation.HasError), ElementName=BudgetGrid}">
<ei:ChangePropertyAction PropertyName="HasBindingError" TargetObject="{Binding}" Value="{Binding (Validation.HasError), ElementName=BudgetGrid}"/>
</ei:PropertyChangedTrigger>
</i:Interaction.Triggers>
<telerik:RadGridView x:Name="BudgetGrid">
</telerik:RadGridView>
</Grid>

It seems though, that the RadGridView don't have any support for Validation.HasError. So question is...is there any way to feed validation errors into a viewmodel without feeding the whole gridview into my viewmodel or using the events in codebehind? Basically some sort of property that's updated on the grid or similar when there are validationerrors?

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 13 Sep 2011, 08:21 AM
Hello Espen,

 Unfortunately the RadGridView does not have a property HasErrors.

What you may do is to use the INotifyDataErrorInfo interface. You could set a property of the view model to the value of the HasErrors property of the INotifyDataErrorInfo and then use this property for the binding.
Another way to get a notification of the errors when a property has been changed with an error is to use the MS ValidationSummary control. It should be notified if there is some errors in the bindings.

I hope that this is helpful.

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Espen
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or