Declined
Last Updated: 20 Apr 2015 11:49 by ADMIN
ADMIN
Stefan
Created on: 04 Oct 2013 04:47
Category: GridView
Type: Bug Report
0
FIX. RadGridView - incorrect scroll bar in hierarchical grid when ExpandAll is used, caused by the fact that the last child row is not fully visible
To reproduce:

public Form1() 

{ 

InitializeComponent(); 

InitializeRadGridView(); 

this.Size = new System.Drawing.Size(782, 647);

radGridView1.DataSource = GetDataSource(); 

radGridView1.MasterTemplate.ExpandAll(); 

} 



private void InitializeRadGridView()

{ 

radGridView1.EnableGrouping = false;

radGridView1.AllowAddNewRow = false; 

radGridView1.MasterTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;

GridViewDataColumn column = new GridViewTextBoxColumn(); 

column.FieldName = "Name";

radGridView1.MasterTemplate.Columns.Add(column); 

GridViewTemplate template = new GridViewTemplate(); 

template.AllowCellContextMenu = false; 

template.AllowColumnHeaderContextMenu = false; 

template.AutoGenerateColumns = false;

template.ShowRowHeaderColumn = false; 

template.ShowColumnHeaders = false; 

template.AllowAddNewRow = false; 

template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; 

radGridView1.Templates.Add(template); 

GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate, template);

relation.ChildColumnNames.Add("Bs"); 

radGridView1.Relations.Add(relation); 

column = new GridViewTextBoxColumn(); 

column.FieldName = "Name";

radGridView1.Templates[0].Columns.Add(column); 

column = new GridViewImageColumn(); 

column.MinWidth = column.MaxWidth = 30;

radGridView1.Templates[0].Columns.Add(column);

radGridView1.Templates[0].AllowRowReorder = true; 

template = new GridViewTemplate(); 

template.AllowCellContextMenu = false;

template.AllowColumnHeaderContextMenu = false; 

template.AutoGenerateColumns = false; 

template.ShowRowHeaderColumn = false; 

template.ShowColumnHeaders = false;

template.AllowAddNewRow = false;

template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; 

radGridView1.Templates[0].Templates.Add(template);

relation = new GridViewRelation(radGridView1.Templates[0], template); 

relation.ChildColumnNames.Add("Cs"); 

radGridView1.Relations.Add(relation); 

column = new GridViewTextBoxColumn(); 

column.FieldName = "Name"; 

radGridView1.Templates[0].Templates[0].Columns.Add(column); 

radGridView1.Templates[0].Templates[0].AllowRowReorder = true; 

}



private List<A> GetDataSource() 

{ 

List<A> list = new List<A>(); 

A a1 = new A(); 

a1.Id = 1;

a1.Name = "A1"; 

list.Add(a1);

A a2 = new A();

a2.Id = 2; 

a2.Name = "A2"; 

list.Add(a2); 

A a3 = new A(); 

a3.Id = 3; 

a3.Name = "A3"; 

list.Add(a3); 

B b1 = new B(); 

b1.Id = 10; 

b1.Name = "B1";

a1.Bs.Add(b1);

B b2 = new B(); 

b2.Id = 20; 

b2.Name = "B2"; 

a1.Bs.Add(b2); 

B b3 = new B(); 

b3.Id = 30; 

b3.Name = "B3"; 

a1.Bs.Add(b3); 

B b4 = new B(); 

b4.Id = 40; b4.Name = "B4"; 

a2.Bs.Add(b4); 

B b5 = new B(); 

b5.Id = 50; b5.Name = "B5"; 

a3.Bs.Add(b5); 

C c1 = new C(); 

c1.Id = 100; 

c1.Name = "C1"; 

b1.Cs.Add(c1); 

b3.Cs.Add(c1); 

C c2 = new C(); 

c2.Id = 200; 

c2.Name = "C2"; 

b1.Cs.Add(c2); 

b2.Cs.Add(c2); 

b2.Cs.Add(c1); 

C c3 = new C(); 

c3.Id = 300; 

c3.Name = "C3"; 

b1.Cs.Add(c3); 

b2.Cs.Add(c3); 

b3.Cs.Add(c3); 

C c4 = new C(); 

c4.Id = 400;

c4.Name = "C4"; 

b4.Cs.Add(c4); 

C c5 = new C(); 

c5.Id = 500; 

c5.Name = "C5"; 

b5.Cs.Add(c5); 

return list; 

} 

} 



public class A 

{ 

public int Id { get; set; } 

public string Name { get; set; }

public List<B> Bs { get; set; }

public A() { Bs = new List<B>();

}

} 



public class B

{ 

public int Id { get; set; } 

public string Name { get; set; } 

public List<C> Cs { get; set; } 

public B() { Cs = new List<C>(); 

} 

} 



public class C 

{ 

public int Id { get; set; } 

public string Name { get; set; 

}

} 



The last row is not fully visible, hence a scroll bar should be shown 

Workaround: collapse and expand the last row in the grid: 

radGridView1.MasterTemplate.ExpandAll(); 

radGridView1.ChildRows[radGridView1.ChildRows.Count - 1].IsExpanded = false; 

radGridView1.ChildRows[radGridView1.ChildRows.Count - 1].IsExpanded = true; 
1 comment
ADMIN
Ralitsa
Posted on: 20 Apr 2015 11:49
The issue is duplicated with feedback item FIX. RadGridView - last row is not visible when scrolling a grid with 4 levels of hierarchy and using Begin/EndUpdate. 
You can track its progress, subscribe for status changes and add your vote/comment to it on the following link: http://feedback.telerik.com/Project/154/Feedback/Details/111795-fix-radgridview-last-row-is-not-visible-when-scrolling-a-grid-with-4-levels-of