Dataform validation errors being repeated

3 posts, 0 answers
  1. peter
    peter avatar
    37 posts
    Member since:
    Feb 2011

    Posted 21 Jun 2012 Link to this post

    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. peter
    peter avatar
    37 posts
    Member since:
    Feb 2011

    Posted 25 Jun 2012 Link to this post

    Hi, does anyone know what the issue is here, I still cant get it to work. Thanks
  3. DevCraft banner
  4. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 25 Jun 2012 Link to this post

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

Back to Top