FIX. RadGridView - add property to GridSpinEditorElement which will prevent the value changing with mouse wheel
To reproduce - bind the grid to a binding list - pin one of the rows - delete this row from the binding list - click somewhere on the grid => exception is thrown
To reproduce: rgvTest.BeginUpdate() For ixTest As Integer = 1 To 2000 Dim rgvrTest As GridViewRowInfo = rgvTest.Rows.AddNew rgvrTest.Cells(0).Value = "Value " & ixTest.ToString Next rgvTest.EndUpdate() rgvTest.Rows(0).IsCurrent = True MessageBox.Show(rgvTest.CurrentCell.RowIndex.ToString)
To reproduce, add a grid with GridViewHyperlinkColumn and enough rows for vertical scrolling. Click a link in a cell so its link will change to visited (its color changes). Scroll down and you will see how the same visited state is transferred to other cells.
To reproduce: - Add a grid to a form and open the property builder - Add couple columns and group by some of the columns - Press ok -> the grid is grouped - Open the Property Builder again, click the X button of the group to remove it and click the OK button of the Property Builder -> the group is not removed.
Workaround, use the following behavior: public class CustomDataRowBehavior : GridDataRowBehavior { protected override bool OnMouseDownRight(MouseEventArgs e) { if (this.IsInEditMode && !this.GridViewElement.EndEdit())
To reproduce: Dim dockmem As New MemoryStream Dim gridmem As New MemoryStream Public Sub SetData() ' dgvSelectList.DataSource = Nothing Dim dt As DataTable dt = New DataTable dt.Columns.Add("VENDCODE") dt.Columns.Add("VENDNAME") dt.Rows.Add("AA2", "Arthur") dt.Rows.Add("AA2", "Arthur") dgvSelectList.DataSource = dt dgvSelectList.BestFitColumns() End Sub Private Sub frmSelectListNG2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load SetData() dgvSelectList.EnableFiltering = False 'Save Grid and Dock layout settings to mem stream and simulate my process SaveSettings() End Sub Public Sub btnGO_Click(sender As System.Object, e As System.EventArgs) Handles btnGO.Click LoadSettings() dgvSelectList.SplitMode = RadGridViewSplitMode.Horizontal SetData() LoadSettings() End Sub Private Sub LoadSettings() gridmem.Position = 0 dockmem.Position = 0 dgvSelectList.LoadLayout(gridmem) rdkSelect.LoadFromXml(dockmem) End Sub Private Sub SaveSettings() gridmem.Position = 0 dockmem.Position = 0 dgvSelectList.SaveLayout(gridmem) rdkSelect.SaveToXml(dockmem) End Sub Workaround - set the datasource to Nothing prior rebinding
To reproduce: - add a grid to the form and use the following code for its setup: radGridView2.Columns.Add("ID"); radGridView2.Columns.Add("Title"); radGridView2.MultiSelect = true; radGridView2.Columns[0].SortOrder = RadSortOrder.Ascending; radGridView2.ReadOnly = true; radGridView2.BeginUpdate(); for (int i = 0; i < 5; i++) { GridViewDataRowInfo row = new GridViewDataRowInfo(radGridView2.MasterTemplate.MasterViewInfo); row.Cells["ID"].Value = i; row.Cells["Title"].Value = "Title " + i; radGridView2.Rows.Add(row); } radGridView2.EndUpdate(true); radGridView2.Rows[0].IsCurrent = true; radGridView2.Rows[0].IsSelected= true; - Once the application is started, hold down the shift key and click the third row in the grid Expected result: the first three rows are selected Actual result: the last three rows are selected WORKAROUND: Use the BeginUpdate and EndUpdate methods of the TableElement, not the control: radGridView2.TableElement.BeginUpdate(); //add rows radGridView2.TableElement.EndUpdate(true);
To reproduce: bind the grid to self reference data source, and on a button click, Fill the TableAdapter Workaround: clear the relations to clear the cache and add them back after the adapter is filled: RadGridView1.Relations.Clear() Me.Table1TableAdapter.Fill(Me.Database8DataSet.Table1) Me.RadGridView1.Relations.AddSelfReference(Me.RadGridView1.MasterTemplate, "TaskID", "ParentTask")
To reproduce: - Set BeginEditMod to BeginEditProgrammatically - Check/uncheck a check box cell and you will be able to edit the rest of the cells
To reproduce: Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load BindGrid() End Sub Private Sub BindGrid() Dim r As New Random() Dim table As New DataTable() table.Columns.Add("ID", GetType(Integer)) table.Columns.Add("Name", GetType(String)) table.Columns.Add("Bool", GetType(Boolean)) For i As Integer = 0 To 39 table.Rows.Add(i, "Row " & i, If(r.[Next](10) > 5, True, False)) Next Me.RadGridView1.DataSource = table End Sub Dim saveName As Integer Private Sub RadGridView1_CellEndEdit(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles RadGridView1.CellEndEdit If e.Column.Name = "Name" Then saveName = RadGridView1.CurrentRow.Cells("ID").Value BindGrid() End If End Sub Private Sub RadGridView1_DataBindingComplete(sender As Object, e As Telerik.WinControls.UI.GridViewBindingCompleteEventArgs) Handles RadGridView1.DataBindingComplete For Each row As GridViewRowInfo In RadGridView1.Rows If row.Cells("ID").Value = saveName Then row.IsCurrent = True RadGridView1.TableElement.EnsureRowVisible(row) Exit For End If Next End Sub WORKAROUND: Rebind the grid in the CellValueChanged event instead of the CellEndEdit event: Private Sub RadGridView1_CellValueChanged(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles RadGridView1.CellValueChanged If e.Column.Name = "Name" Then saveName = RadGridView1.CurrentRow.Cells("ID").Value BindGrid() End If End Sub
To reproduce: - Add a checkbox column to a grid - Add the following code to the ValueChanged event: void radGridView1_ValueChanged(object sender, EventArgs e) { if (radGridView1.CurrentColumn.Name == "BoolColumn") {
When RadRadioButton column is bound to a column containing integer values and RadGridView is being reenabled all radio buttons are with ToggleState.On.
http://screencast.com/t/mZDwbWS8 WORKAROUND: Set the UseCompatibleTextRendering property of RadGridView to false.
To reproduce: - Add grid to a form and populate it with data. - Show and hide the the excel like filtering several times.
When scrolling to the bottom of the grid with the mouse, the last row is not lined up with the bottom of the grid. Also, when doing this, clicking on any row, leads to row jumping down to align properly, but a different row is selected. Workaround: public Form1() { InitializeComponent(); radGridView1.MouseDown+=radGridView1_MouseDown; radGridView1.MouseUp+=radGridView1_MouseUp; } bool scrolling = false; private void radGridView1_MouseDown(object sender, MouseEventArgs e) { ScrollBarThumb thumb = radGridView1.ElementTree.GetElementAtPoint(e.Location) as ScrollBarThumb; if (thumb != null) { scrolling = true; } } private void radGridView1_MouseUp(object sender, MouseEventArgs e) { if (scrolling) { scrolling = false; int scrollBarValue = radGridView1.TableElement.VScrollBar.Value; radGridView1.MasterTemplate.Refresh(); radGridView1.TableElement.VScrollBar.Value = scrollBarValue; } }
To reproduce: - Set the column like this: GridViewMaskBoxColumn col = new GridViewMaskBoxColumn(); col.Mask = "&&&&&&&&&&"; col.MaskType = MaskType.Standard; col.FieldName = "Name"; col.TextMaskFormat = MaskFormat.IncludeLiterals; - Type two words and press enter. Workaround: public class MyRadMaskedEditBoxEditor : RadMaskedEditBoxEditor { public override object Value { get { if (this.MaskTextBox.Mask == "my mask") { return this.MaskTextBox.Value; } return base.Value; } set { base.Value = value; } } }
Use the following code snippet: public Form1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Item", typeof(string)); dt.Columns.Add("Price", typeof(decimal)); for (int i = 0; i < 10; i++) { dt.Rows.Add(i % 5, "Item" + i, i * 2.25m); } this.radGridView1.DataSource = dt; GridViewDecimalColumn customCalculatedCol = new GridViewDecimalColumn("Custom Calculated Column"); customCalculatedCol.Name = "Custom Calculated Column"; customCalculatedCol.Expression = "SumIf(Id)"; radGridView1.Columns.Add(customCalculatedCol); GridViewDecimalColumn customCalculatedCola = new GridViewDecimalColumn("Custom Col_A"); radGridView1.Columns.Add(customCalculatedCola); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; Telerik.Data.Expressions.ExpressionContext.Context = new CustomExpressionContext(radGridView1); } public class CustomExpressionContext : Telerik.Data.Expressions.ExpressionContext { private RadGridView grid; public CustomExpressionContext(RadGridView grid) { this.grid = grid; } public double SumIf(int currentId) { double countIf = 0; decimal sumIf = 0; foreach (GridViewRowInfo r in this.grid.Rows) { if ((int)r.Cells["Id"].Value == currentId) { countIf++; sumIf += (decimal)r.Cells["Price"].Value; } } return (double)sumIf; } } Workaround: invalidate the affected rows manually private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e) { if (e.Column.Name == "Price" || e.Column.Name == "Id") { foreach (GridViewRowInfo r in this.radGridView1.Rows) { if ((int)r.Cells["Id"].Value == (int)e.Row.Cells["Id"].Value) { r.InvalidateRow(); } } } }
To reproduce: - Add grid to a blank form. - Add summary rows and group descriptors. - Add rows upon a button click. - You will notice that not all rows are visible. Workaround: radGridView1.TableElement.Update(GridUINotifyAction.RowHeightChanged, null); radGridView1.TableElement.VScrollBar.Value = radGridView1.TableElement.VScrollBar.Maximum - radGridView1.TableElement.VScrollBar.LargeChange;
To reproduce: - Add several rows to a grid where the paging is enabled (make sure that last row has unique values) - Use the excel like filtering in the first page, notice that the last value is missing. Workaround: void radGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e) { RadListFilterPopup popup = e.FilterPopup as RadListFilterPopup; if (popup != null) { foreach (GridViewRowInfo row in radGridView1.Rows) { var value = row.Cells[e.Column.Name].Value; if (!(popup.MenuTreeElement.DistinctListValues.Contains(value))) { popup.MenuTreeElement.DistinctListValues.Add(value.ToString(), value.ToString()) ; } } } }