The GridViewNewRowInfo is in modified state when the DefaultValuesNeeded event is used. This causes the UserAddingRow event to be fired. Workaround: void radGridView1_DefaultValuesNeeded(object sender, GridViewRowEventArgs e) { e.Row.Cells["SearchType"].Value = "BI"; FieldInfo fieldInfo = typeof(GridViewRowInfo).GetField("state", BindingFlags.NonPublic | BindingFlags.Instance); BitVector32 state = (BitVector32)fieldInfo.GetValue(e.Row); state[2] = false; fieldInfo.SetValue(e.Row, state); e.Row.InvalidateRow(); }
change the localization provider for one gridview only (e.g. we have multiple different grids in our application, but I want to apply that custom RadGridLocalizationProvider selectively to only few of them)
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) {
I use a BindingList to bind our data to grid. But when I set to this list two classes with common interface but different implementation (override of baseclass virtual property), an data exception error is thrown. The same code works fine in previous versions.
After the delete, the item is removed from the BindingList, but it still appears in the RadGridView (or deleted a wrong item). The binding doesn't trigger the change in the UI/View.
ADD. RadGridView - add a Tag property to the columns
- 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
RadGridView scrolls to the top when copy and paste operations are performed. The grid scrolls to left when there are a lot of columns as well. In addition this is only observed when the cell is not in edit mode. Workaround: public class MyGridBehavior : BaseGridBehavior { public override bool ProcessKey(KeyEventArgs keys) { bool isPaste = false; if (keys.Control && keys.KeyCode == Keys.V && this.GridViewElement.Template.ClipboardCopyMode != GridViewClipboardCopyMode.Disable) { if (!(this.GridViewElement.Template.GridReadOnly || this.GridViewElement.Template.ReadOnly)) { isPaste = true; } } GridTableElement currentTableElement = this.GridViewElement.CurrentView as GridTableElement; int vScroll = currentTableElement.VScrollBar.Value; int hScroll = currentTableElement.HScrollBar.Value; bool result = base.ProcessKey(keys); if (isPaste) { currentTableElement.VScrollBar.Value = vScroll; currentTableElement.HScrollBar.Value = hScroll; } return result; } } this.radGridView1.GridBehavior = new MyGridBehavior();
Add RadPageView with couple pages Add a grid to one of the pages Start editing a cell Click another page item (tab) to change the selected page => even though no validation is performed, the selected page is not changed unless a second click is performed. The first click just closes the editor and the second one changes the selected page.
Add BestFitColumnMode.AllCells that performs column best fit operation over all rows.
1. Create a new project and add RadGridView. 2. Bind it to a data source with many columns, so that a scrollbar appears at run time. 3. Set up validation. 4. Run the project and put a cell in edit mode. 5. Write a value that will not pass the validation. 6. Use the horizontal scrollbar to scroll to right.
The events are fired in the following order: UserAddingRow, EditorRequired, UserAddedRow eventfired when the new is pinned at the bottom and TAB key is processed. Workaround: public class FixGridNewRowBehavior : GridNewRowBehavior { protected override bool ProcessTabKey(System.Windows.Forms.KeyEventArgs keys) { bool isInEditMode = this.EditorManager.IsInEditMode; if (isInEditMode) { IGridNavigator navigator = GridViewElement.Navigator; bool isLeftNavigation = navigator.IsFirstColumn(GridViewElement.CurrentColumn) && keys.Shift; bool isRightNavigation = navigator.IsLastColumn(GridViewElement.CurrentColumn) && !keys.Shift; if (isLeftNavigation || isRightNavigation) { this.GridViewElement.EndEdit(); } if (isLeftNavigation) { navigator.SelectLastColumn(); } else if (isRightNavigation) { navigator.SelectFirstColumn(); } if (isLeftNavigation || isRightNavigation) { GridViewElement.BeginEdit(); return true; } } return base.ProcessTabKey(keys); } } BaseGridBehavior gridBehavior = this.radGridView1.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewNewRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewNewRowInfo), new FixGridNewRowBehavior());
StackOverFlow exception when the user sorts a GridView control. The exception occurs in the CellValueNeeded method when accessing e.RowIndex. The GridView is in VirtualMode. The error doesn't occur during the initial load of the data.
When exporting to HTML or PDF image columns should be exported properly.
1. Create a new project with RadGridView and setup 2 level hierarchy. 2. Add a checkbox column at the second level and set its pinned state to Left. 3. Run the application. 4. Expand the first row and click on the checkbox. Be sure that RadGridView contains enough columns in its child view to show horizontal scrollbar. Workaround: create a custom view definition public class CustomTableViewDefinition : TableViewDefinition { public override IRowView CreateViewUIElement(GridViewInfo viewInfo) { CustomTableElement table = new CustomTableElement(); return table; } } public class CustomTableElement : GridTableElement { protected override Type ThemeEffectiveType { get { return typeof(GridTableElement); } } public override bool EnsureCellVisible(GridViewRowInfo rowInfo, GridViewColumn column) { if (column.IsPinned) { return true; } return base.EnsureCellVisible(rowInfo, column); } } Set the view definition to the child template by using the ViewDefinition property this.gridViewDemoData.Templates[0].ViewDefinition = new CustomTableViewDefinition();
How to handle this case: Subscribe to the CellValidating event and add logic for validation. For example: If e.Value Is Nothing Then e.Cancel = True End If Additionally you can handle the DataError event to handle cases where users are trying to submit invalid data through the grid to its data source. Finally, you can subscribe to the ContextMenuOpening event where to hide the "Clear value" item from context menu with following code snippet: For i As Integer = 0 To e.ContextMenu.Items.Count - 1 If e.ContextMenu.Items(i).Text = "Clear Value" Then e.ContextMenu.Items(i).Visibility = Telerik.WinControls.ElementVisibility.Collapsed End If Next
If one exports a grid with AutoSizeRows set to true the rows that are not visible or have not been scrolled to in the grid will be exported with wrong (very small) height.
To reproduce: void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) { GridFilterCellElement filterCell = e.CellElement as GridFilterCellElement; if (filterCell != null)
When exporting to excel the exporter exports null values as empty strings instead of empty excel cells.
Filtering of enum data type throws exception.