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

data validation errors not shown

6 Answers 110 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ralf
Top achievements
Rank 1
Ralf asked on 06 Sep 2011, 10:21 AM
Hi Telerik,

my data are validated in a ViewModel, which implements INotifyDataErrorInfo.
The data are changed via code, if an error occurs the row does not reflect that error
(if i step in the cell the error is shown).

I must call  items.refresh to trigger the estimated behavior, but it seems not to be the right way.

Are there any other solutions?


Greatings
Ralf

6 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 08 Sep 2011, 02:46 PM
Hi Ralf Bellmann,

 Generally there would not be such a problems. The RadGridView have a mechanism to listen for the INotifyDataErrorInfo.ErrorsChanged event of its underlying objects.

We would need more detailed description of the particular scenario to figure out what would be wrong. How does your ViewModel implement the INotifyDataErrorInfo? Do you have some custom bindings?

Kind regards,
Didie
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Ralf
Top achievements
Rank 1
answered on 08 Sep 2011, 03:53 PM
Hi Didie,

i am loading cell templates at runtime because i must generate columns on the fly.

here my generic template:
var sb = new StringBuilder();
sb.Append("<DataTemplate ");
sb.Append("xmlns:this='clr-namespace:TelerikClient;assembly=TelerikClient' ");
sb.AppendFormat("<this:{0} DataContext=\"{{Binding [{1}] }}\" />", control, uniqueName);
sb.Append("</DataTemplate>");
return XamlReader.Load(sb.ToString()) as DataTemplate;

You can see that i am binding an Indexer Property from the ViewModel. The Indexrr Property is also a ViewModel.
Both ViewModels (for row and for indexer) have the same ViewModelBase with INotifyDataErrorInfo implemented.
The Error will be created in the Indexer Property.
Control is a specific UserControl with the relevant Bindings. Here the one Part from the Control:
<telerik:RadNumericUpDown 
Visibility="{Binding Path=IsReadOnly, Converter={StaticResource vConverterInverse}, FallbackValue=Collapsed}"
Margin="10,0,0,0"
 Value="{Binding NewPrice, Mode=TwoWay}"             
 NumberDecimalDigits="3"             
SmallChange="0.01"/>

If  a user edit the property in the cell all is ok, the error is shown like expected.
But if i am changing the property in code nothing happens, here i must refresh the grid.

Not very helpfull ?
ralf

OK - opened a ticket 462423 with attached project.
0
Dimitrina
Telerik team
answered on 14 Sep 2011, 08:11 AM
Hello Ralf,

 As I have answered in your other post, the validation errors are not shown as you use a custom binding. In your case, you have binding to a property of the underlying property.

Due to a performance optimization, the RadGridView is only listening for a notifications from its direct underlying objects. The notification of the property on the second level never goes to the GridView.

Best wishes,
Didie
the Telerik team

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

0
Ralf
Top achievements
Rank 1
answered on 14 Sep 2011, 08:42 AM
Hi Didie,

i am not sure what you meaning with custom binding.
Its a binding to an indexer property and behind this property i have another viewmodel.
I understand that you optimize your grid, but if i change the property directly in the grid cell the error
propagate correctly to the row ?!

Hm .. please tell me if i made a mistake with my thinking.

Sorry, i did not saw your answer on the atoher post.
Please ignore this reply.

Bye Ralf


0
Dimitrina
Telerik team
answered on 17 Sep 2011, 11:46 AM
Hello Ralf,

 For the understanding of anyone interested in a similar problem, here I will post the explanation that I have answered to you in your other post. 

If you have Items bound to the GridView. Then each of this Item has Child and the Name of the Child is bound to a specific column(the column is bound to Child.Name).This is a custom binding. When the change of the value (of the Name property) is done in Edit mode (from the UI), then we know what object it is and the GridView handles its notifications. When the change of the value is done in ViewMode, then only the notifications raised by the most parent property (i.e. the ones from the Item.Child property that is directly underlying in the GridView) are handled.

Best wishes,
Didie
the Telerik team

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

0
2extreme4u
Top achievements
Rank 1
answered on 30 Sep 2011, 06:06 PM
What do you propose we do in this case?  Maybe I just simply don't I understand your answer...

I am implementing a change in my Cell DataTemplateSelector but we're already at our wits end with the performance of the grid when templating cells...

If there's a way to get this to work without a Template, please explain what needs to happen.
Tags
GridView
Asked by
Ralf
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Ralf
Top achievements
Rank 1
2extreme4u
Top achievements
Rank 1
Share this question
or