RowEvents not working when using datatemplate

2 posts, 0 answers
  1. Gilbert van Veen
    Gilbert van Veen avatar
    68 posts
    Member since:
    Oct 2009

    Posted 18 Nov 2011 Link to this post

    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.
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 22 Nov 2011 Link to this post

    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 >>
  3. DevCraft banner
Back to Top