Unplanned
Last Updated: 06 May 2016 06:13 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 13 Apr 2016 06:37
Category: GridView
Type: Bug Report
1
FIX. RadGridView - search result is not visible when the UseScrollbarsInHierarchy property is set to true
To reproduce:

private void Form1_Load(object sender, EventArgs e)
{
    this.productsTableAdapter.Fill(this.nwindDataSet.Products);
    this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories);
    
    radGridView1.AllowSearchRow = true;
    radGridView1.DataSource = nwindDataSet.Categories;
    radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    radGridView1.UseScrollbarsInHierarchy = true;

    GridViewTemplate template = new GridViewTemplate();
    template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    template.DataSource = nwindDataSet.Products;
    radGridView1.MasterTemplate.Templates.Add(template);

    GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate);
    relation.ChildTemplate = template;
    relation.RelationName = "CategoriesProducts";
    relation.ParentColumnNames.Add("CategoryID");
    relation.ChildColumnNames.Add("CategoryID");
    radGridView1.Relations.Add(relation); 
}

Workaround:
private void radGridView1_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e)
{
    if (this.radGridView1.CurrentRow != null)
    {
        if (this.radGridView1.CurrentRow.HierarchyLevel > 0)
        {
            tableElement.ScrollToRow((GridViewHierarchyRowInfo)(this.radGridView1.CurrentRow).Parent);
             this.radGridView1.TableElement.EnsureRowVisible((GridViewHierarchyRowInfo)(this.radGridView1.CurrentRow).Parent);
            tableElement.ScrollToRow(this.radGridView1.CurrentRow);
            tableElement.EnsureRowVisible(this.radGridView1.CurrentRow);
        }
    }
}


0 comments