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

4 posts, 0 answers
  1. Mohan
    Mohan avatar
    2 posts
    Member since:
    Nov 2011

    Posted 08 Nov 2011 Link to this post

    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.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Nov 2011 Link to this post

    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 >>

  3. Mohan
    Mohan avatar
    2 posts
    Member since:
    Nov 2011

    Posted 08 Nov 2011 Link to this post

    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()
            {
  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Nov 2011 Link to this post

    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 >>

Back to Top