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

RowEvents not working when using datatemplate

1 Answer 17 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gilbert van Veen
Top achievements
Rank 1
Gilbert van Veen asked on 18 Nov 2011, 10:42 AM
Hi,

For some reason the following events are not working when using DataTemplates in a column:

_BeginningEdit

 

 

 

 

 

_RowValidated
_RowValidating
...

The events are working for column "Type 2" but for column "Type 3" they don't.

The XAML code is:

<telerik:GridViewComboBoxColumn Header="Type 3" Width="150">
                              <telerik:GridViewColumn.CellTemplate>
                                  <DataTemplate>
                                      <telerik:RadComboBox Name="TypeComboBox" DisplayMemberPath="TypeDescription" SelectedValuePath="TypeId" SelectedValue="{Binding HourType, Mode=TwoWay}" ItemsSource="{Binding CategoryTypes, Source={StaticResource CategoryTypeList}}" IsEnabled="{Binding Id, Converter={StaticResource HourTypeFormatter}}" SelectionChanged="TypeComboBox_SelectionChanged"/>
                                  </DataTemplate>
                              </telerik:GridViewColumn.CellTemplate>
                          </telerik:GridViewComboBoxColumn>
                            
                          <telerik:GridViewComboBoxColumn Header="Type 2" Width="150"
                              DisplayMemberPath="TypeDescription" SelectedValueMemberPath="TypeId"  DataMemberBinding="{Binding HourType, Mode=TwoWay}" ItemsSource="{Binding CategoryTypes, Source={StaticResource CategoryTypeList}}" >
                          </telerik:GridViewComboBoxColumn>

When the user changes a value in one of the columns of a row I want to enable a button.

Of course I can use the SelectionChange event of the comobox but that will also be fired as I set the itemsource of the grid.

Update: My situation is solved:

<

 

 

Button Click="ToolBarClick" Tag="Save" IsEnabled="{Binding ElementName=DS_Categories, Path=HasChanges}">

 

 

 

 

<Image Width="16" Height="16" Source="/GaSuite;component/Images/save.png" Tag="Save" ToolTipService.ToolTip="Save"/>

 

 

 

 

</Button>

 


The HasChanges did the trick for me but the fact stays that it is very strange why the events didn't work.

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 22 Nov 2011, 09:13 AM
Hi Gilbert Van Veen,

Indeed those events are only raised when a cell from the row is in "edit mode". To edit the cell, you should put the RadComboBox in a CellEditTemplate. To show the selected value, you could use a TextBlock in the CellTemplate.

Please let me know how this works for you.

Regards,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
GridView
Asked by
Gilbert van Veen
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or