RadGridView - the Row property in the event arguments of the RowValidating event is null when the user deletes a row. Also the Column property in the event arguments of the CellValidating event is null when the user deletes a row.
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; } } } }
To reproduce: public Form1() { InitializeComponent(); Random r = new Random(); DataTable table = new DataTable(); table.Columns.Add("ID", typeof(int)); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Bool", typeof(bool)); table.Columns.Add("DateColumn", typeof(DateTime)); for (int i = 0; i < 10; i++) { table.Rows.Add(i, "Row " + i, r.Next(10) > 5 ? true : false, DateTime.Now.AddHours(i)); } this.radGridView1.DataSource = table; radGridView1.Columns[0].FormatString = "{0:n3}"; } MemoryStream ms = new MemoryStream(); private void radButton1_Click(object sender, EventArgs e) { // ms.SetLength(0); reset memory stream to save new layout radGridView1.SaveLayout(ms); } private void radButton2_Click(object sender, EventArgs e) { radGridView1.LoadLayout(ms); } }
FIX. RadGridView - UserAddedRow is not fired when the AddNewRowPosition is Bottom and you tab through the cells to add the row. The result is that the row is added but the event is not fired.
The control just does not appear in the destination solution.
To reproduce use the code below and try to type in "000" in a cell GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn("Phone"); radGridView1.Columns.Add(comboColumn); comboColumn.DataSource = new string[] { "0", "00", "000", "0001" }; comboColumn.Width = 200; comboColumn.DropDownStyle = RadDropDownStyle.DropDown; comboColumn.AutoCompleteMode = AutoCompleteMode.Suggest;
RadGridView can not change the current column (by using the IsCurrent of the desired column) in the CurrentColumnChanged event.
FIX. RadGridView - allowing row reorder on the first level of hierarchy (template[0]) results in visual representation of the reordering while no actual reordering is performed.
To reproduce: GridViewMaskBoxColumn maskBoxColumn = new GridViewMaskBoxColumn(); maskBoxColumn.Name = "MaskEditBoxColumn"; maskBoxColumn.HeaderText = "MaskEditBoxColumn"; maskBoxColumn.MaxLength = 5; maskBoxColumn.MaskType = MaskType.Numeric; maskBoxColumn.Mask = "C"; maskBoxColumn.FormatString = "{0:C}"; radGridView1.MasterTemplate.Columns.Add(maskBoxColumn); WORKAROUND: void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e) { GridSpinEditor editor = e.ActiveEditor as GridSpinEditor; if (editor != null) { GridSpinEditorElement element = (GridSpinEditorElement)editor.EditorElement; element.TextChanging += element_TextChanging; } } void element_TextChanging(object sender, TextChangingEventArgs e) { e.Cancel = e.NewValue.Length > 5; } Comment : Removed the MaxLength property from GridViewMaskBoxColumn. You should use the Mask property and set an appropriate mask value. For example the #### mask allows entering only 4 digits.
To reproduce: radChartView1 = new RadChartView(); radChartView1.Parent = this; radChartView1.Dock = DockStyle.Fill; radChartView1.ShowGrid = true; CartesianGrid grid = ((CartesianGrid)radChartView1.GetArea<CartesianArea>().Grid); grid.DrawVerticalFills = true; grid.AlternatingHorizontalColor = false; grid.AlternatingVerticalColor = false; grid.BackColor = Color.Red; grid.ForeColor = Color.Blue; grid.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Solid; DateTimeContinuousAxis horizontalAxis = new DateTimeContinuousAxis(); horizontalAxis.MajorStepUnit = Telerik.Charting.TimeInterval.Day; horizontalAxis.MajorStep = 2; horizontalAxis.LabelFormat = "{0:dd/MM/yyyy}"; LinearAxis verticalAxis1 = new LinearAxis(); verticalAxis1.AxisType = AxisType.Second; LinearAxis verticalAxis2 = new LinearAxis(); verticalAxis2.AxisType = AxisType.Second; verticalAxis2.HorizontalLocation = AxisHorizontalLocation.Right; LineSeries line1 = new LineSeries(); line1.HorizontalAxis = horizontalAxis; line1.VerticalAxis = verticalAxis1; LineSeries line2 = new LineSeries(); line2.HorizontalAxis = horizontalAxis; line2.VerticalAxis = verticalAxis2; line1.DataPoints.Add(new CategoricalDataPoint(26d, DateTime.Now.AddDays(-6))); line1.DataPoints.Add(new CategoricalDataPoint(20d, DateTime.Now.AddDays(-5))); line1.DataPoints.Add(new CategoricalDataPoint(12d, DateTime.Now.AddDays(-4))); line1.DataPoints.Add(new CategoricalDataPoint(15d, DateTime.Now.AddDays(-2))); line1.DataPoints.Add(new CategoricalDataPoint(21d, DateTime.Now.AddDays(-1))); line2.DataPoints.Add(new CategoricalDataPoint(32d, DateTime.Now.AddDays(-6))); line2.DataPoints.Add(new CategoricalDataPoint(52d, DateTime.Now.AddDays(-4))); line2.DataPoints.Add(new CategoricalDataPoint(35d, DateTime.Now.AddDays(-3))); line2.DataPoints.Add(new CategoricalDataPoint(36d, DateTime.Now.AddDays(-2))); line2.DataPoints.Add(new CategoricalDataPoint(11d, DateTime.Now.AddDays(-1))); this.radChartView1.Series.Add(line1); this.radChartView1.Series.Add(line2); Workaround - no
To reproduce, copy a date time cell value and paste in excel.
Extend the cell elements with a button(s) (via decorator for example) which will be visible without putting the grid in edit mode. The buttons should not be visible by default and their visibility will be controlled via property of the column. These buttons can be RadButtonElements which will not hurt the performance. Their purpose will be to inform the end user that some cell is a combo or a date time cell without having to open its editor in advance. When the button is clicked, the corresponding action should be executed e.g. for combo cell, open the editor and show the popup; for spin cell open the editor and perform the click of the desired button. Same goes for the rest of the editors - mccb, color, browse, date time, etc.
1.Pressing left while the first cell in the gird is current, should not cycle the cells- do nothing 2. Pressing right while the last cell of the last row is current, should not cycle the cells - do nothing
To reproduce: - create and populate a grid - attempt to load invalid XML file (it can be empty as well) in a try/catch block => the grid remains in an invalid state WORKAROUND: void radButton1_Click(object sender, EventArgs e) {
If you have the grid bound to a data source and then you assign another data source containing some of the columns that exists in the first one (with the same name), those columns are not shown: public partial class Form1 : Form { public Form1() { InitializeComponent(); DataTable table = new DataTable(); table.Columns.Add("col1"); table.Columns.Add("col2"); for (int i = 0; i < 10; i++) { table.Rows.Add("A " + i, "B " + i); } radGridView1.DataSource = table; } private void radButton1_Click(object sender, EventArgs e) { DataTable table = new DataTable(); table.Columns.Add("col1"); table.Columns.Add("col2"); table.Columns.Add("col3"); table.Columns.Add("col4"); for (int i = 0; i < 10; i++) { table.Rows.Add("Z " + i, "X " + i, "C " + i, "V " + i); } //work around //radGridView1.MasterTemplate.Reset(); radGridView1.DataSource = table; } }
Setting the custom format is not applied to the cell. To reproduce: Dim customColumn As New GridViewDateTimeColumn() customColumn.Width = 200 customColumn.Name = "custom" customColumn.EditorType = GridViewDateTimeEditorType.TimePicker customColumn.FormatString = "{0:HH:mm}" customColumn.Format = DateTimePickerFormat.Custom customColumn.CustomFormat = "HH:mm" RadGridView1.MasterTemplate.Columns.Add(customColumn) RadGridView1.Rows.Add(DateTime.Now)
- Add a row called "Telerik.Hello", filter for contains "Telerik" - no rows displayed - Add some rows some of which empty, filter does not contain "some string", the empty rows are removed, while they should remain
To reproduce: - use the code below to create an application - start it and click the Id column twice (so you will sort it first ascending and then descending) - double click the first row (with ID=9) => the BindingList current is still the row with ID 0, while it should be the row with ID 9 public partial class Form1 : Form { public Form1() { InitializeComponent(); SetDefaults(); } private void SetDefaults() { radGridView1.MasterTemplate.AutoGenerateColumns = false; radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; radGridView1.MasterTemplate.EnableAlternatingRowColor = true; radGridView1.TableElement.AlternatingRowColor = Color.FromArgb(0xEB, 0xEF, 0xFB); radGridView1.MasterTemplate.ShowGroupedColumns = true; radGridView1.MasterTemplate.EnableGrouping = true; radGridView1.MasterTemplate.MultiSelect = false; radGridView1.EnableFiltering = true; radGridView1.EnableFastScrolling = true; radGridView1.TableElement.TableHeaderHeight = 50; } private void Form1_Load(object sender, EventArgs e) { var users = new EmployeeList(); for (int i = 0; i < 10; i++) { var user = new Employee(); user.Id = i; user.Name = "John Doe " + i; users.Add(user); } employeeListBindingSource.DataSource = users; } private void radGridView1_CellDoubleClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { if (e.RowIndex == -1 || e.Row.RowElementType != typeof(GridDataRowElement) || !(e.Row is GridViewDataRowInfo)) return; var selectedUser = employeeListBindingSource.Current as Employee; MessageBox.Show(selectedUser.Name); } } public class Employee { public int Id { get; set; } public string Name { get; set; } public Employee() { } } public class EmployeeList : BindingList<Employee> { public EmployeeList() { } }
To reproduce - Have a page view with two pages - one empty and one with a grid - put some cell in the grid in edit mode and cancel its validation in the CellValidating event - at this point you cannot change the current cell in the grid (which is desired) but you are able to switch to another page in the page view, thus its SelectedPageChanging event fires (which is not desired)
ADD. RadGridView - add row selection with Space in MultiSelection mode Notice: This functionality works only in multiselection and EditMode different than RadGridViewBeginEditMode.BeginEditOnKeystrokeOrF2 RadGridViewBeginEditMode.BeginEditOnKeystroke