Completed
Last Updated: 05 Apr 2012 09:11 by ADMIN
ADMIN
Stefan
Created on: 05 Apr 2012 09:11
Category: GridView
Type: Bug Report
1
FIX. RadGridView - exception when deleting rows selected with the translucent rectangle
To reprouduce, have a grid with multiple rows selected using the translucent rectangle and use the following code on a button click:

using System;

using System.Data;

using System.Windows.Forms; 

using Telerik.WinControls.UI; 

namespace Lab.Grid

{ public partial class GridSelectionException : MainForm { private RadGridView gridView = new RadGridView();

public GridSelectionException() { InitializeComponent(); gridView.Dock = DockStyle.Fill; gridView.Parent = this; gridView.BringToFront(); Random r = new Random(); DataTable table = new DataTable(); table.Columns.Add("ID"); table.Columns.Add("Name"); table.Columns.Add("Bool"); for (int i = 0; i < 10; i++) { table.Rows.Add(i, "Row" + i, (r.Next(10) > 5) ? true : false); } gridView.DataSource = table; gridView.MultiSelect = true; } protected override void OnButton1Click() { //your code for deleting rows if (this.gridView.SelectedRows.Count > 0) { System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; GridViewDataRowInfo[] rows = new GridViewDataRowInfo[this.gridView.SelectedRows.Count]; this.gridView.SelectedRows.CopyTo(rows, 0); this.gridView.TableElement.BeginUpdate(); for (int i = 0; i <= rows.Length - 1; i++) { //rows[i].IsSelected = false; rows[i].Delete(); } this.gridView.TableElement.EndUpdate(); System.Windows.Forms.Cursor.Current = Cursors.Arrow; } } } } 
0 comments