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

Validations in Gridview using Data Annotations +EF+MVVM+RIA

3 Answers 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mohan
Top achievements
Rank 1
Mohan asked on 08 Nov 2011, 12:06 PM
Hi,

In our project we are using DataAnnotations to do the validations. attributes are propagating to client, but validation is not being fired in grid.

In this case, Field entity contains FieldSize entity.
Below is the generated code: for FieldSize entitiy

   
        /// <summary>
        /// Gets or sets the 'Size' value.
        /// </summary>
        [DataMember()]
        [Required(ErrorMessage="Size is mandatory")]
        public double Size
        {
          .....
XAML code is: 

 <avcu:AVGrid Name="dataGrid1" ItemsSource="{Binding Path=Field.FieldSizes,Mode=TwoWay}">
                <avcu:AVGrid.Columns>
 <avcu:AVDataGridColumn Header="Size" Width="Auto">
                        <avcu:AVDataGridColumn.CellTemplate>
                            <DataTemplate>
                                <avcu:AVTextBox Text="{Binding Path=Size, Mode=TwoWay}"  Width="30"/>
                            </DataTemplate>
                        </avcu:AVDataGridColumn.CellTemplate>
                    </avcu:AVDataGridColumn>
                </avcu:AVGrid.Columns>
            </avcu:AVGrid>

Validations is not happening! Could you please help me to solve this. could you share me a sample application with the above requirements.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Nov 2011, 12:08 PM
Hi,

 Can you post more info about AVGrid and AVDataGridColumn?

Kind regards,
Vlad
the Telerik team

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

0
Mohan
Top achievements
Rank 1
answered on 08 Nov 2011, 12:23 PM
thank you for your quick reply.
They are simple wrappers around, RadGridView and  GridViewDataColumn


    public class AVGrid : RadGridView
    {
         public AVGrid() : base() 
        {

 public class AVDataGridColumn : GridViewDataColumn
    {
        public AVDataGridColumn()
            : base()
        {
0
Vlad
Telerik team
answered on 08 Nov 2011, 12:37 PM
Hello,

 I suggest you to check this article to know more how to define your bindings. 

All the best,
Vlad
the Telerik team

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

Tags
GridView
Asked by
Mohan
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Mohan
Top achievements
Rank 1
Share this question
or