Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
635
Enable editing on a single record?
posted

I have a datagrid, and allowEdit has been disabled. I want to allow editing on a single record when a button is pushed.

How do I enable editing for a single record?

Parents
  • 635
    posted

    Implemented this by setting using the CellActivating and CellDeactivating events to control the AllowEdit setting on the field. Not sure if this is the best way to implement it.

    private void OnCellActivating(object sender, CellActivatingEventArgs e) {
        if(e.Cell.Record.Tag != null && e.Cell.Record.Tag.ToString().CompareTo("CheckedOut") == 0) {
     e.Cell.Field.Settings.AllowEdit = true;
        }
        else if(e.Cell.Record.IsAddRecord) {
     e.Cell.Field.Settings.AllowEdit = true;
        } else {
     e.Cell.Field.Settings.AllowEdit = false;
        }
    }

    private void OnCellDeactivating(object sender, CellDeactivatingEventArgs e){
        e.Cell.Field.Settings.AllowEdit = false;
    }

    The only problem is that when a cell has a drop down in it (XamComboEditor), if it's enabled, and I mouse over other fields in that column, it paints a drop down arrow. If I click on a another cell in that field that's not enabled, and then mouseover that cell, the down arrow is removed. 

     

Reply Children
No Data