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

[Solved] Customize GridView Row Validation using MVVM

4 Answers 403 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
gautham
Top achievements
Rank 1
gautham asked on 03 Nov 2010, 02:59 PM

Hello,

      Please help to customize row Validation using MVVM, without using RIA service.

     1) I want to validate the entered data on row as per my requirement.

      2) I am using DataTemplate.

    >  I have presented small code snippet of XAML

  
<syncControls:GridView ItemSource="{Binding MyItemSource}"
  
<syncControls:GridView.Columns>
  
  
  
<syncControls:GridViewDataColumn Header="Location Type" DataMemberBinding="{Binding LocationTypeCode, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}">
  
<syncControls:GridViewDataColumn.CellTemplate>
  
<DataTemplate>
  
<TextBlock Text="{Binding LocationType, Mode=TwoWay}"/>
  
</DataTemplate>
  
</syncControls:GridViewDataColumn.CellTemplate>
  
<syncControls:GridViewDataColumn.CellEditTemplate>
  
<DataTemplate>
  
<syncControls:ComboBox x:Name="uvLocationTypes" ItemsSource="{Binding LocationTypes, Mode=TwoWay}" 
  
DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding LocationTypeCode, Mode=TwoWay}">
  
</syncControls:ComboBox>
  
</DataTemplate>
  
</syncControls:GridViewDataColumn.CellEditTemplate>
  
</syncControls:GridViewDataColumn>
  
  
</syncControls:GridView.Columns>
  
  
</syncControls:GridView




4 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 04 Nov 2010, 02:56 PM
Hi gautham,

 You can use the INotifyDataErrorInfo to perform validation directly in your model. This approach is detailed in this blog post. RadGridView is compatible with this interface, so that whatever errors it raises will show up in the UI.

All the best,
Yavor Georgiev
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
0
gautham
Top achievements
Rank 1
answered on 06 Nov 2010, 07:06 AM
Hello Yavor,

 I am not looking for RIA service based validation. The example you are presented using RIA service. Please help me  to validate without using RIA.

Regards,
Gautham

,



0
Accepted
Yavor Georgiev
Telerik team
answered on 08 Nov 2010, 11:36 AM
Hi gautham,

 You don't need RIA services to implement INotifyDataErrorInfo. You can check out the attached sample. Even though it is for WPF, the same code will work for Silverlight.

Kind regards,
Yavor Georgiev
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
0
gautham
Top achievements
Rank 1
answered on 08 Nov 2010, 08:12 PM
Hello,

Thank-you very much.
Regards,
Gautham

Tags
GridView
Asked by
gautham
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
gautham
Top achievements
Rank 1
Share this question
or