Approved
Last Updated: 08 Nov 2016 14:18 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 20 Oct 2016 12:07
Category: GridView
Type: Bug Report
1
FIX. RadGridView - strip buttons in the hierarchical RadPageViewStripElement don't work for the last row
To reproduce:

public RadForm1()
{
    InitializeComponent();  

    this.radGridView1.MasterTemplate.Columns.Add(new GridViewDecimalColumn("ParentId"));
    this.radGridView1.MasterTemplate.Columns.Add(new GridViewTextBoxColumn("ParentName"));
     
    this.radGridView1.MasterTemplate.Rows.Add(1, "Item" + 1);
    this.radGridView1.MasterTemplate.Rows.Add(2, "Item" + 2);
     
    this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

    for (int i = 0; i < 10; i++)
    {
        GridViewTemplate template = new GridViewTemplate();
        template.AllowAddNewRow = false;
        template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
        template.Caption = "Tab" + i;
        template.Columns.Add(new GridViewDecimalColumn("Id"));
        template.Columns.Add(new GridViewTextBoxColumn("Name"));
        this.radGridView1.MasterTemplate.Templates.Add(template);
        template.HierarchyDataProvider = new GridViewEventDataProvider(template);
    }
    
    this.radGridView1.RowSourceNeeded += radGridView1_RowSourceNeeded;
}

private void radGridView1_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
{
    for (int i = 0; i < 10; i++)
    {
        GridViewRowInfo row = e.Template.Rows.NewRow();
        row.Cells["Id"].Value = e.ParentRow.Cells["ParentId"].Value;
        row.Cells["name"].Value = "child row" + i;
        e.SourceCollection.Add(row);
    }
}

private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    GridDetailViewCellElement cell = e.CellElement as GridDetailViewCellElement; 
    if (cell != null)
    { 
        RadPageViewStripElement strip = cell.PageViewElement as RadPageViewStripElement;
        strip.StripButtons = StripViewButtons.LeftScroll | StripViewButtons.RightScroll; 
    }
}

If you have just one row on the master level, the strip buttons don't navigate the tabs.

Workaround:  add a dummy row that is hidden: 

private void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
{
    if (e.RowElement.RowInfo == this.radGridView1.Rows.Last())
    {
        e.RowElement.RowInfo.Height = 1;
        e.RowElement.RowInfo.MinHeight = 1;
        e.RowElement.RowInfo.MaxHeight = 1;
    }
    else
    { 
        e.RowElement.RowInfo.Height = 25;
        e.RowElement.RowInfo.MinHeight = 25;
        e.RowElement.RowInfo.MaxHeight = 25;
    }
}
Attached Files:
0 comments