Welcome to the Xceed Community | Help
Community Search  
More Search Options

Enable Row Deletion on Detail Only

Sort Posts: Previous Next
  •  06-15-2012, 6:49 PM Post no. 32260

    Enable Row Deletion on Detail Only

    I have a master/detail grid that I want to be able to delete from from the detail table, but not the master table.  I set IsDeleteCommandEnabled to true on the DetailConfiguration, and to false on the master grid.  However, the delete key doesn't work.  When I set IsDeleteCommandEnabled on the master grid, it starts working, but then users can delete rows from the master as well (which I don't want).

    How can I get this to work?

  •  06-18-2012, 4:16 PM Post no. 32265 in reply to 32260

    Re: Enable Row Deletion on Detail Only

    Hi Nathan,

    In order to delete DataItems from the Datagrid you should set the IsDeleteCommandEnabled property on the DataGrid to True. However, to delete only Details' items you should catch the DeletingSelectedItems event in code behind and cancel deletion if the CurrentContext is a master one(ParentDataGridContext will be null as a master item has no parent).

    For example your event handler could be something like:


    private void DataGridControl_DeletingSelectedItems(object sender, Xceed.Wpf.DataGrid.CancelRoutedEventArgs e)
    {
               if (OrdersDataGrid.CurrentContext.ParentDataGridContext == null)
               e.Cancel = true;
    }


    Best regards,

    Fawzi Bablli
    Developer Technical Support
    Xceed Software Inc.
  •  06-19-2012, 10:19 AM Post no. 32271 in reply to 32265

    Re: Enable Row Deletion on Detail Only

    That works!  Thanks!
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.