Completed
Last Updated: 31 Mar 2014 09:21 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 28 Oct 2013 03:40
Category: GridView
Type: Bug Report
1
FIX. RadGridView - closing child template selects different row
To reproduce: 1.Bind RadGridView to hierarchical data - no vertical scroll-bar is visible. 2.Select a certain row and expand the child template (click the expander) - vertical scroll-bar appears. 3.Scroll several rows downwards. 4.Click the expander to close the child template (the vertical scroll-bar should hide). As a result the selected row is changed.

Workaround: follow the approach below: GridViewHierarchyRowInfo row = null; bool keepParentRow = false; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); radGridView1.AutoGenerateHierarchy = true; radGridView1.DataSource = this.nwindDataSet; radGridView1.DataMember = "Categories"; radGridView1.CurrentRowChanging += radGridView1_CurrentRowChanging; radGridView1.ChildViewExpanded += radGridView1_ChildViewExpanded; radGridView1.MouseDown += radGridView1_MouseDown; } private void radGridView1_CurrentRowChanging(object sender, CurrentRowChangingEventArgs e) { RadGridView grid = sender as RadGridView; if (grid != null && row != null && keepParentRow) { e.Cancel = true; } } private void radGridView1_MouseDown(object sender, MouseEventArgs e) { RadGridView grid = sender as RadGridView; if (grid != null) { GridExpanderItem expander = grid.ElementTree.GetElementAtPoint(e.Location) as GridExpanderItem; if (expander != null && row != null) { keepParentRow = true; } else { keepParentRow = false; } } } private void radGridView1_ChildViewExpanded(object sender, Telerik.WinControls.UI.ChildViewExpandedEventArgs e) { RadGridView grid = sender as RadGridView; if (grid != null && e.IsExpanded == false) { row = e.ParentRow as GridViewHierarchyRowInfo; } }
0 comments