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

GridViewComboBoxColumn not showing validation hints

3 Answers 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kelly
Top achievements
Rank 1
Kelly asked on 13 Mar 2013, 05:19 PM
I'm seeing some weird behavior with a GridViewComboBoxColumn when validation fails.  When I put a null value in the column, I get hints (red ! icon, red box around row) but nothing in the cell itself as I do in other grids.  The property bound to the column has a [Required] attribute on it.  Am I doing something wrong?

Thanks!

<telerik:RadGridView x:Name="StatusGrid"        ...                                      ItemsSource="{Binding Path=Retailer.Statuses}"        prismCommands:RowEditEndedCommand.Command="{Binding ValidateStatus}"        SelectionMode="Extended"        ShowGroupPanel="False"        ValidatesOnDataErrors="InViewMode">        <telerik:RadGridView.Columns> <telerik:GridViewComboBoxColumn Width="375"                        DataMemberBinding="{Binding SelectedType,                                            Mode=TwoWay}"                        DisplayMemberPath="Description"                        Header="Status"                        HeaderCellStyle="{StaticResource RequiredGridViewHeaderCellStyle}"                        IsReadOnlyBinding="{Binding IsExisting}"                        ItemsSourceBinding="{Binding Source={StaticResource ViewDataContext},                                                     Path=DataSource.StatusTypes}" />                <telerik:GridViewDataColumn Width="100"                        DataFormatString="{}{0:MM/dd/yyyy}"                        DataMemberBinding="{Binding EffectiveDate,                                                    Mode=TwoWay}"                        Header="Effective Date"                        HeaderCellStyle="{StaticResource RequiredGridViewHeaderCellStyle}"                                                         IsReadOnlyBinding="{Binding IsExisting}" />                         </telerik:RadGridView.Columns>                     </telerik:RadGridView>


3 Answers, 1 is accepted

Sort by
0
Kelly
Top achievements
Rank 1
answered on 13 Mar 2013, 08:31 PM
Got it figured out.  There was a property being used that was declared in a partial class related to one of the automatically generated entities that RIA Services creates.  
0
Kelly
Top achievements
Rank 1
answered on 13 Mar 2013, 09:10 PM
Now something even stranger is happening.  I'm getting the validation error message twice.  See attached image.

The property being bound to is below.  The xaml is the same as I posted above.

        [Required(ErrorMessage = "Status is required.")]
        public RetailerStatusType SelectedType
        {
            get { return this.selectedType; }
            set
            {
 
                if ((this.selectedType != value))
                {
                    this.selectedType = value;
 
                    if (this.selectedType == null)
                    {
                        StatusTypeId = 0;
                        StatusCode = string.Empty;
                    }
                    else
                    {
                        StatusTypeId = this.selectedType.Id;
                        StatusCode = this.selectedType.Code;
                    }
                }
            }
        }
0
Yoan
Telerik team
answered on 14 Mar 2013, 01:39 PM
Hello Kelly,

Can you give us more details how the validation is performed in your application? Are you using only DataAnnotations? It will be great if you can send us a sample project which reproduces the problem? We will debug it on our side and will check what is going on.

All the best,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Kelly
Top achievements
Rank 1
Answers by
Kelly
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or