Hurdles on 'CellEditingEnded' event on DataGrid when we have Checkbox on DataTemplate

8 posts, 0 answers
  1. gautham
    gautham avatar
    31 posts
    Member since:
    Dec 2008

    Posted 15 Nov 2010 Link to this post

    Hello,

     

    I have attached a behavior on Datagrid; it has ‘CellEditingEnded’ event. It works fine when I place the Combobox, Textbox, and Autocompletebox inside the Datatemplate.

     

    Problem:

    The ‘CellEditingEnded’ event will not fire, when I place the Checkbox control inside Datatemplate.

     

    My Code Snippet:

    public class UpdateValueBehavior : Behavior<RadGridView>
           {
                  protected override void OnAttached()
                  {
                         base.OnAttached();
                         this.AssociatedObject.CellEditEnded += new EventHandler<
                    GridViewCellEditEndedEventArgs>(AssociatedObject_CellEditEnded);
                  }
      
                  void AssociatedObject_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
                  {
                       // my logic
                  }
           }

    Regards,
    Gautham

  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 16 Nov 2010 Link to this post

    Hi,

     Can you post more info about your grid version?

    Regards,
    Vlad
    the Telerik team
    See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
  3. gautham
    gautham avatar
    31 posts
    Member since:
    Dec 2008

    Posted 16 Nov 2010 Link to this post

    Hello Vlad,

    My gridVersion:

      

        Assembly Telerik.Windows.Controls.GridView.dll, v2.0.50727 

     

    Regards

     Gautham

  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 16 Nov 2010 Link to this post

    Hello,

     This is the framework version - not the grid version. 

    All the best,
    Vlad
    the Telerik team
    See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
  5. gautham
    gautham avatar
    31 posts
    Member since:
    Dec 2008

    Posted 16 Nov 2010 Link to this post

    Hello,

     > DataGrid Version: 2010.2 812

    My code snippet:

                      <syncControls:GridViewDataColumn.CellTemplate>
      <DataTemplate>
      <syncControls:CheckBox IsChecked="{Binding IsAllowToDispatch, Mode=TwoWay}"/>
    </DataTemplate>
    </syncControls:GridViewDataColumn.CellTemplate>
    <syncControls:GridViewDataColumn.CellEditTemplate>
    <DataTemplate>
    <syncControls:CheckBox IsChecked="{Binding IsAllowToDispatch, Mode=TwoWay}"/>
    </DataTemplate>
    </syncControls:GridViewDataColumn.CellEditTemplate>

    Problem: It will work fine when the 'checkbox' is in edit mode, 
    but when I just click using mouse button. This event will not fire.

    Regards,
    Gautham
  6. Yavor Georgiev
    Admin
    Yavor Georgiev avatar
    982 posts

    Posted 18 Nov 2010 Link to this post

    Hello gautham,

     If you place a CheckBox in the CellTemplate of a GridViewColumn, you will be able to manipulate the CheckBox directly, without entering edit mode in RadGridView. Without entering edit mode, the CellEditEnded event will not fire. I propose to set the IsReadOnly property of the CheckBox in the CellTemplate to true, so that clicking it will enter edit mode and display the CheckBox in the CellEditTemplate. This way, when the CheckBox is manipulated, the CellEditEnded event will fire.

    Regards,
    Yavor Georgiev
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  7. gautham
    gautham avatar
    31 posts
    Member since:
    Dec 2008

    Posted 19 Nov 2010 Link to this post

    Hello,

     But, we don't have a ReadOnly Property for checkbox, so I made  used of 'ISEnabled' property. Please help to customize the checkbox by implementing an another property 'ReadOnly'

    Anyway this is very useful solution.


    Regards,
    Gautham
  8. Anand
    Anand avatar
    12 posts
    Member since:
    Dec 2011

    Posted 22 Aug 2012 Link to this post

    Yavor ,Could not able to implement your solution. Can you post code  ?

    Anand
Back to Top