Completed
Last Updated: 16 Sep 2015 10:11 by ADMIN
ADMIN
Jack
Created on: 21 Mar 2013 12:03
Category: GridView
Type: Bug Report
1
FIX. RadGridView - gets in invalid state when editing a cell and changing the active child view tab at the same time.
1. Create new project with RadGridView and setup hierarchy with multiple tabs.
2. Run the project.
3. Open a child view tab and start editing a filter cell.
4. While the editor is open, change the active tab.
5. Repeat this operation several times.

Workaround: the issue appears because RadGridView does not close its editor when changing the tab page and it thinks that it is still in edit mode when selecting the old page. You can work around the issue by using a custom cell element. Consider the code below:

public class CustomDetailsCellElement : GridDetailViewCellElement
{
    public CustomDetailsCellElement(GridViewColumn column, GridRowElement row)
        : base(column, row)
    {
    }
 
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(GridDetailViewCellElement);
        }
    }
 
    protected override RadPageViewElement CreatePageViewElement(IRadPageViewProvider pageViewProvider)
    {
        RadPageViewElement pageView =  base.CreatePageViewElement(pageViewProvider);
        pageView.ItemSelecting += new EventHandler<RadPageViewItemSelectingEventArgs>(PageViewElement_ItemSelecting);
        return pageView;
    }
 
    void PageViewElement_ItemSelecting(object sender, RadPageViewItemSelectingEventArgs e)
    {
        if (this.IsInValidState(true) && this.GridControl != null && this.GridControl.IsInEditMode)
        {
            this.GridControl.EndEdit();
        }
    }
 
}

You should handle also the CreateCell event in order to replace default child view cell in RadGridView:
 
void gvReviewMigration_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
    if (e.CellType == typeof(GridDetailViewCellElement))
    {
        e.CellType = typeof(CustomDetailsCellElement);
    }
}
0 comments