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

BindingValidationError

5 Answers 99 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fred Zhao
Top achievements
Rank 1
Fred Zhao asked on 20 Nov 2009, 09:37 PM
Hi,

Controls in DataColumn cell templates are no longer displaying validation errors on binding (NotifyOnValidationError=True, ValidatesOnExceptions=True) and BindingValidationError doesn't seem to be bubbled to the Grid... is this a bug in Q3?

Fred

5 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 23 Nov 2009, 08:47 AM
Hello Fred Zhao,

Generally when you are using CellTemplate and CellEditTemplate properties, you have to update these templates state (valid and invalid) manually. Can you provide me with more detailed information about your scenario and how you use these properties (a sample project will be great)? If you want some more advanced edit templates you can take a look at this blog post for additional information.

Greetings,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Fred Zhao
Top achievements
Rank 1
answered on 23 Nov 2009, 03:01 PM
I've attached a sample of our grid below... we put editor controls such as datepicker and combobox in the CellTemplate and set the grid to readonly so that the controls are immediately editable. When we throw an exception on validation in the setter, these controls would display the notification before. However this is no longer happening in Q3. Thanks for looking into this.

Fred

 

<telerikGridView:RadGridView Grid.Row="2"
           x:Name="ItemGrid"
           ItemsSource="{Binding Items, Mode=TwoWay}"
           CanUserResizeColumns="True"
           AutoGenerateColumns="False"
           ShowGroupPanel="False"
           ColumnsWidthMode="Fill"
           CanUserFreezeColumns="False"
           IsReadOnly="True"
           RowIndicatorVisibility="Collapsed"
           VerticalGridlinesVisibility="Collapsed"
           GridLinesVisibility="Horizontal"
           CanUserReorderColumns="False"
           CanUserInsertRows="False"
           UseAlternateRowStyle="True"
           IsBusy="{Binding IsLoading}"
           FontWeight="{StaticResource Bold}"
           FontFamily="{StaticResource Arial}"
           Foreground="{StaticResource #002664}"
           FontSize="{StaticResource 8pt}"
           Margin="0"
           VerticalAlignment="Top"
           Height="330"
           validations:ValidationScope.ValidationScope="{Binding CreateItemValidationScope}">
  <telerikGridView:RadGridView.Columns>
    <telerikGridView:GridViewDataColumn Header="Form" UniqueName="TaxFormShortDesc" TextWrapping="Wrap">
    </telerikGridView:GridViewDataColumn>

    <telerikGridView:GridViewDataColumn Header="Promise&#13;Date" UniqueName="PromiseDate" Width="95">
      <telerikGridView:GridViewDataColumn.CellTemplate>
        <DataTemplate>
          <sdk:DatePicker Height="25" Width="90" HorizontalAlignment="Left" Style="{StaticResource DatePickerStyle}"
                          SelectedDate="{Binding PromiseDate, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                          validations:ValidationScope.ValidateBoundProperty="SelectedDate" />
        </DataTemplate>
      </telerikGridView:GridViewDataColumn.CellTemplate>
    </telerikGridView:GridViewDataColumn>

    <telerikGridView:GridViewDataColumn Header="Processing&#13;Method *" UniqueName="ProcessMethod" Width="75">
      <telerikGridView:GridViewDataColumn.CellTemplate>
        <DataTemplate>
          <ComboBox Height="25"
                    Width="70"
          HorizontalAlignment="Left"
                    ItemsSource="{Binding ProcessMethods}"
          DisplayMemberPath="Description"
                    SelectedItem="{Binding ProcessMethod, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                    validations:ValidationScope.ValidateBoundProperty="SelectedItem"/>
        </DataTemplate>
      </telerikGridView:GridViewDataColumn.CellTemplate>
    </telerikGridView:GridViewDataColumn>

  </telerikGridView:RadGridView.Columns>
</telerikGridView:RadGridView>

 

 

 

 

 

0
Nedyalko Nikolov
Telerik team
answered on 26 Nov 2009, 12:12 PM
Hi Fred Zhao,

I'm attaching application that demonstrates how you can show invalid state of the editing control. In order to test just select date after current date.
Unfortunately I'm not sure that MS DatePicker has such invalid state.

Kind regards,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Nick Wood
Top achievements
Rank 1
answered on 12 Mar 2010, 06:44 AM
Hi
I have an issue with the SelectedItem NotifyOnValidationError. I have the same code for the RadDatePicker to ensure start dates are not greater than end dates in a filter range and it works really well.

I tried to apply the same structure to the RadGridView SelectedItem to ensure that at least one item is selected. Here is the code:

SelectedItem="{Binding SelectedPrintSiteItem, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" 

And in the viewmodel:
public TblPrintSite SelectedPrintSiteItem 
        { 
            get 
            { 
                return _SelectedPrintSiteItem; 
            } 
 
            set 
            { 
                if (value == null
                { 
                    throw new Exception("You must select at least 1 Print Site."); 
                } 
                else 
                { 
                    _SelectedPrintSiteItem = value; 
                    if (PropertyChanged != null
                        PropertyChanged(thisnew PropertyChangedEventArgs("SelectedPrintSiteItem")); 
                }  
            } 
        } 

The issue here is that while it does show the validation summary, it does not show a message next to the control and the IsEnabled binding on the submit button is not updated and therefore remains active:
<Button Margin="5" Content="Update Filters" Commanding:Click.Command="{Binding FilterSubmitCommand}" Width="150"  
                    IsEnabled="{Binding Path=HasErrors, ElementName=ValidationSummary1, Converter={StaticResource HasErrorsToIsEnabledConverter}}" /> 

Any ideas on why this could be?

Thanks for any help.


0
Nedyalko Nikolov
Telerik team
answered on 15 Mar 2010, 04:48 PM
Hi Nick Wood,

Could you please try your scenario with our latest version? I'm attaching my test project with our latest binaries for your reference. Let me know if this doesn't help.

Sincerely yours,
Nedyalko Nikolov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Fred Zhao
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Fred Zhao
Top achievements
Rank 1
Nick Wood
Top achievements
Rank 1
Share this question
or