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

Dataform validation errors being repeated

2 Answers 128 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
peter
Top achievements
Rank 1
peter asked on 21 Jun 2012, 01:07 PM
Hi, I have a dataform, and i am implementing IDataErrorInfo, the problem i am encountering is that errors are being displayed twice for instance "Please Provide First Name" is repeated twice in the validation summary. I am using a style for the validation summary which i actually saw in one of your samples "CRM". This is what the style looks like maybe someone can spot whats causing my issue;

<dataForm:DataFormValidationSummary x:Name="PART_ValidationSummary" Visibility="Collapsed" Grid.Row="3"  Height="Auto">
    <dataForm:DataFormValidationSummary.Style>
        <Style TargetType="dataForm:DataFormValidationSummary">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <ItemsControl IsTabStop="False" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Errors}" Background="{StaticResource ValidationBrush}" Foreground="{StaticResource MainBrush}" >
                            <ItemsControl.Style>
                                <Style TargetType="ItemsControl">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate>
                                                <ScrollViewer IsTabStop="False" Name="ScrollViewer" Background="{TemplateBinding Background}" BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" Foreground="{TemplateBinding Foreground}">
                                                    <ItemsPresenter/>
                                                </ScrollViewer>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="ItemTemplate">
                                        <Setter.Value>
                                            <DataTemplate>
                                                <StackPanel Orientation="Horizontal">
                                                    <TextBlock Margin="5,5,0,5" Text="{Binding Path=ErrorContent}" />
                                                </StackPanel>
                                            </DataTemplate>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="MaxHeight" Value="75"/>
                                </Style>
                            </ItemsControl.Style>
                        </ItemsControl>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="MaxHeight" Value="75"/>
        </Style>
    </dataForm:DataFormValidationSummary.Style>
</dataForm:DataFormValidationSummary>
 And heres an example of one of my Validation columns;

string _error; 
const string ErrorText = "Error in Member Details"
public string Error 
    get { return _error; } 
public string this[string columnName] 
    get 
    
        _error = null
        switch (columnName) 
        
            case "EnvironmentName"
                
                    if (string.IsNullOrEmpty(EnvironmentName)) 
                        _error = "must contain data"
                    break
                
        
        return _error; 
    
}

Then my dataform on the fields i need validated I have;

NotifyOnValidationError

 

 

=True,ValidatesOnDataErrors=True

 


I appreciate any help, thanks

2 Answers, 1 is accepted

Sort by
0
peter
Top achievements
Rank 1
answered on 25 Jun 2012, 07:57 AM
Hi, does anyone know what the issue is here, I still cant get it to work. Thanks
0
Pavel Pavlov
Telerik team
answered on 25 Jun 2012, 12:41 PM
Hi  Peter ,

We do not have a known issue matching  your description . Can you please share a runnable project so we can investigate.
Also I see you have redefined the template of the summary. Do you get the erroneous behavior without modifications to the default template ?

Greetings,
Pavel Pavlov
the Telerik team

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

Tags
DataForm
Asked by
peter
Top achievements
Rank 1
Answers by
peter
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or