Completed
Last Updated: 12 Dec 2015 12:10 by ADMIN
ADMIN
Dimitar
Created on: 18 Apr 2014 11:05
Category: GridView
Type: Bug Report
1
FIX. RadGridView - in hierarchy mode when the master template is reset the user cannot add new row.
To reproduce:
- Open the hierarchy example in the demo application.
- Select Auto-GenratedDataSet and add a new row in the third level template.
- Select Manually generated for Bound Mode and then re-select Auto-GenratedDataSet
- Try to add new row again. Yo will notice that the new row is not added.

Workaround:
class MyNewRowBehavior : GridNewRowBehavior
{
    protected override bool ProcessEnterKey(KeyEventArgs keys)
    {
        if (this.GridControl.IsInEditMode)
        {
            GridViewSynchronizationService.SuspendEvent(this.GridControl.CurrentRow.ViewTemplate, KnownEvents.CurrentChanged);
            bool result = base.ProcessEnterKey(keys);
            GridViewSynchronizationService.ResumeEvent(this.GridControl.CurrentRow.ViewTemplate, KnownEvents.CurrentChanged);
            return result;
        }
        else
        {
            return base.ProcessEnterKey(keys);
        }
    }
 
    protected override bool ProcessTabKey(KeyEventArgs keys)
    {
        if (this.GridControl.IsInEditMode)
        {
            GridViewSynchronizationService.SuspendEvent(this.GridControl.CurrentRow.ViewTemplate, KnownEvents.CurrentChanged);
            bool result = base.ProcessTabKey(keys);
            GridViewSynchronizationService.ResumeEvent(this.GridControl.CurrentRow.ViewTemplate, KnownEvents.CurrentChanged);
            this.Navigator.SelectNextColumn();
 
            return result;
        }
        else
        {
            return base.ProcessTabKey(keys);
        }
    }
}

The default behavior can be changed as follows:
((BaseGridBehavior)radGridView1.GridBehavior).UnregisterBehavior(typeof(GridViewNewRowInfo));
((BaseGridBehavior)radGridView1.GridBehavior).RegisterBehavior(typeof(GridViewNewRowInfo), new MyNewRowBehavior());
0 comments