Add a new property AllowSelection/EnableSelection in order to control whether the use can select a cell/row. Workaround: Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.ProductsTableAdapter.Fill(Me.NwindDataSet.Products) Me.RadGridView1.CurrentRow = Nothing AddHandler Me.RadGridView1.SelectionChanging, AddressOf Grid_SelectionChanging AddHandler Me.RadGridView1.CurrentRowChanging, AddressOf Grid_CurrentRowChanging End Sub Private Sub Grid_SelectionChanging(sender As Object, e As Telerik.WinControls.UI.GridViewSelectionCancelEventArgs) e.Cancel = True End Sub Private Sub Grid_CurrentRowChanging(sender As Object, e As Telerik.WinControls.UI.CurrentRowChangingEventArgs) e.Cancel = True End Sub
To reproduce: if (e.CellElement.ColumnInfo.HeaderText == "CategoryID") { e.CellElement.DrawText = false; } else { e.CellElement.ResetValue(LightVisualElement.DrawTextProperty, ValueResetFlags.Local); } Workaround: e.CellElement.DrawText = true;
Hi, We got an issue comparable to the one already described (see 245938), using the same demo project 1) I add LastDeliveryDateTimeLocal column 2) remove groups 3) click on "Start async notifications" 4) click on the filter icon next to "LastDeliveryDateTimeLocal" column name 5) uncheck some values (08/09/2016, 11/11/2016, 03/01/2017) 6) click Ok => NullReferenceException
Steps to reproduce: 1. Add a grid to a form and fill it with some data 2. Add a button and in the click event: a. Assign a new GridPrintStyle instance to the PrintStyle property b. Subscribe for the PrintCellFormatting event of the grid c. Call the PrintPreview method of the grid 3. Add a break point in the event handler of the PrintCellFormatting 4. Start the app and click the button. You will see that the break point is never hit.
"High Performance with RadGridView and Virtual Mode including Filtering, Sorting and Grouping" example is not working for RadGridView Q3 2015. When I click on the Column header for sorting ( same thing for grouping and filtering) and I m getting exception "Sorting operation is not supported in VirtualMode.". Same sample is working for Q3 2014. Following is the URL for the sample http://www.telerik.com/support/kb/winforms/gridview/details/high-performance-with-radgridview-and-virtual-mode-including-filtering-sorting-and-grouping
1. Create a new project and add RadGridView. 2. Bind it and set the IsVisible property for some rows to false. 3. Run the project. 4. Scroll to bottom.
Use attached to reproduce. Workaround: class MySpreadExportRenderer : SpreadExportRenderer { public override void SetWorksheetColumnWidth(int columnIndex, double value, bool isCustom) { if (value > 2000) { value = 2000; } base.SetWorksheetColumnWidth(columnIndex, value, isCustom); } }
how can i insert , update or delete? i tried after choosing the data source , it shows the data correctly but when i edit or add a new item the database is not affected (allow edit,delete and add row are set to true)
Hello, Please create a GridViewDateTimeOffsetColumn to support DateTimeOffset type. A datetimeoffset editor would be good and support of nullable date types. Thank you!
How to reproduce: check the attached project and comment the workaround Workaround: public partial class RadForm1 : Telerik.WinControls.UI.RadForm { private BindingList<TestDataObject> data; public RadForm1() { InitializeComponent(); this.data = new BindingList<TestDataObject>(); this.LoadData(); GridViewTextBoxColumn textColumn = new GridViewTextBoxColumn(); textColumn.Name = "Name"; textColumn.FieldName = "Name"; textColumn.HeaderText = "Name"; this.radGridView1.Columns.Add(textColumn); GridViewDateTimeColumn dateColumn = new GridViewDateTimeColumn(); dateColumn.Name = "Date"; dateColumn.FieldName = "Date"; dateColumn.HeaderText = "Date"; this.radGridView1.Columns.Add(dateColumn); GridViewMaskBoxColumn maskBoxColumn = new GridViewMaskBoxColumn(); maskBoxColumn.Name = "Price"; maskBoxColumn.FieldName = "Price"; maskBoxColumn.HeaderText = "Price"; maskBoxColumn.MaskType = MaskType.Numeric; maskBoxColumn.Mask = "C"; maskBoxColumn.TextAlignment = ContentAlignment.BottomRight; maskBoxColumn.FormatString = "{0:C}"; maskBoxColumn.DataType = typeof(decimal); this.radGridView1.Columns.Add(maskBoxColumn); this.radGridView1.DataSource = this.data; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; //Workaround this.radGridView1.CellBeginEdit += RadGridView1_CellBeginEdit; this.radGridView1.EditorRequired += RadGridView1_EditorRequired; } void RadGridView1_EditorRequired(object sender, EditorRequiredEventArgs e) { if (e.EditorType == typeof(RadMaskedEditBoxEditor)) { e.EditorType = typeof(MyRadMaskedEditBoxEditor); } } private void RadGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) { RadMaskedEditBoxEditor maskedEditBoxEditor = e.ActiveEditor as RadMaskedEditBoxEditor; if (maskedEditBoxEditor != null && e.Row.Cells[e.ColumnIndex].Value == null) { maskedEditBoxEditor.MaskTextBox.EnableNullValueInput = true; } else { maskedEditBoxEditor.MaskTextBox.EnableNullValueInput = false; } } private void LoadData() { for (int i = 0; i < 1000; i++) { decimal? price = null; if (i % 2 == 0) { price = i * 100; } this.data.Add(new TestDataObject { Name = "Name " + i, Date = DateTime.Now.AddDays(i), Price = price }); } } } public class TestDataObject { public string Name { get; set; } public DateTime Date { get; set; } public decimal? Price { get; set; } } public class MyRadMaskedEditBoxEditor : RadMaskedEditBoxEditor { public override object Value { get { return base.Value; } set { if (value == null && (this.MaskTextBox.EnableNullValueInput || this.MaskTextBox.MaskType != MaskType.Numeric)) { this.MaskTextBox.Value = this.NullValue; } else { base.Value = value; } } } }
To reproduce: please refer to the attached sample project and gif file. Workaround: add the column programmatically, not at design time.
To reproduce: private void RadGridView1_UserAddingRow(object sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e) { radGridView1.MasterView.TableAddNewRow.CancelAddNewRow(); } See attached video. Workaround: private void RadGridView1_UserAddingRow(object sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e) { radGridView1.MasterView.TableAddNewRow.CancelAddNewRow(); radGridView1.MasterView.ViewTemplate.DataView.CurrentItem.IsCurrent = false; }
Use attached to reproduce. Workaround - Set the position at runtime. Me.radGridView1.MasterTemplate.AddNewRowPosition = Telerik.WinControls.UI.SystemRowPosition.Bottom
Use attached to reproduce. With versions prior 2015.3.930 the results are different.
I have a GridView (Winforms v. 2017.3.1017.40, same problem with 2017.2.502.40) configured as on the attached screenshot (made some groups, made a search, and used the "excel-like" filter on a column to uncheck some values). Then I try to click on some column headers to sort the grid. After a few clicks, I get this error : InvalidOperationException: La collection a été modifiée ; l'opération d'énumération peut ne pas s'exécuter. I got different stacktrace with the same error : InvalidOperationException: La collection a été modifiée ; l'opération d'énumération peut ne pas s'exécuter. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at System.Collections.Generic.List`1.Enumerator.MoveNext() at Telerik.WinControls.UI.DataGroup.<GetEnumerator>d__0.MoveNext() at Telerik.WinControls.UI.GridViewGroupRowInfo.get_ChildRows() at Telerik.WinControls.UI.GridViewRowInfo.HasChildRows() at Telerik.WinControls.UI.PrintGridTraverser.CanStepInHierarchy() at Telerik.WinControls.UI.GridTraverser.StepInHierarchy() at Telerik.WinControls.UI.GridTraverser.MoveNextCore() at Telerik.WinControls.UI.GridTraverser.MoveNext() at Telerik.WinControls.UI.GridViewSearchRowInfo.worker_DoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument) ----- InvalidOperationException: Failed to compare two elements in the array. ---> NullReferenceException: Object reference not set to an instance of an object. at Telerik.WinControls.UI.GridViewRowInfoComparer.CompareRows(GridViewRowInfo x, GridViewRowInfo y, SortDescriptorCollection context) at System.Collections.Generic.ArraySortHelper`1.InternalBinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer) at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer) --- End of inner exception stack trace --- at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer) at System.Collections.Generic.List`1.BinarySearch(Int32 index, Int32 count, T item, IComparer`1 comparer) at Telerik.Collections.Generic.HybridIndex`1.PerformWithQuickSort() at Telerik.Collections.Generic.HybridIndex`1.get_Items() at Telerik.Collections.Generic.Index`1.GetEnumerator() at Telerik.WinControls.Data.GroupBuilder`1.Perform(IReadOnlyCollection`1 items, Int32 level, Group`1 parent) at Telerik.WinControls.Data.GroupBuilder`1.get_Groups() at Telerik.WinControls.UI.GridViewInfo.Refresh() at Telerik.WinControls.UI.GridViewInfo.get_ChildRows() at Telerik.WinControls.UI.ViewInfoTraverser.SetCollectionForStage(Boolean initializeCollection) at Telerik.WinControls.UI.ViewInfoTraverser.ChangeCollectionForward() at Telerik.WinControls.UI.ViewInfoTraverser.MoveNextCore() at Telerik.WinControls.UI.ViewInfoTraverser.MoveNext() at Telerik.WinControls.UI.GridTraverser.MoveNextCore() at Telerik.WinControls.UI.GridTraverser.MoveNext() at Telerik.WinControls.UI.BaseGridNavigator.NavigateToRow(GridViewRowInfo row, Boolean select) at Telerik.WinControls.UI.BaseGridNavigator.ProcessViewChangedEvent(GridViewEvent eventData) at Telerik.WinControls.UI.BaseGridNavigator.ProcessEventCore(GridViewEvent eventData) at Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessCollection(GridViewEvent gridEvent, PriorityWeakReferenceList list, GridEventProcessMode processMode) at Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessEvent(GridViewEvent gridEvent) at Telerik.WinControls.UI.GridViewSynchronizationService.NotifyListeners(GridViewEvent gridEvent) at Telerik.WinControls.UI.GridViewSynchronizationService.FlushEvents() at Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewEvent gridEvent) at Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewTemplate template, GridViewEvent eventData, Boolean postUI) at Telerik.WinControls.UI.GridViewTemplate.DispatchDataViewChangedEvent(Object sender, DataViewChangedEventArgs args) at Telerik.WinControls.UI.GridViewTemplate.OnViewChanged(Object sender, DataViewChangedEventArgs e) at Telerik.WinControls.UI.MasterGridViewTemplate.OnViewChanged(Object sender, DataViewChangedEventArgs e) at Telerik.WinControls.Data.RadDataView`1.RebuildData(Boolean notify) at Telerik.WinControls.Data.RadDataView`1.OnNotifyPropertyChanged(PropertyChangedEventArgs e) at Telerik.WinControls.Data.RadCollectionView`1.OnNotifyPropertyChanged(String propertyName) at Telerik.WinControls.UI.GridViewSortDescriptorCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs args) at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e) at Telerik.WinControls.Data.SortDescriptor.set_Direction(ListSortDirection value) at Telerik.WinControls.UI.GridViewColumn.Sort(RadSortOrder sortOrder, Boolean multiSortMode) at Telerik.WinControls.UI.GridHeaderCellElement.Sort(RadSortOrder sortOrder) at Telerik.WinControls.UI.GridHeaderRowBehavior.OnMouseUp(MouseEventArgs e) at Telerik.WinControls.UI.BaseGridBehavior.OnMouseUp(MouseEventArgs e) at Telerik.WinControls.UI.RadGridView.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at Telerik.WinControls.RadControl.WndProc(Message& m) at Telerik.WinControls.UI.RadGridView.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ------ InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at System.Collections.Generic.List`1.Enumerator.MoveNext() at Telerik.WinControls.UI.DataGroup.<GetEnumerator>d__0.MoveNext() [...] at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Alto.Client.Controls.Dispatch.DispatchResources.DeliveryPointFilterManager.get_DeliveryPointsVisible() in d:\Builds\45153\Alto\Alto.Prod\src\Alto\Alto.Client\Controls\Dispatch\DispatchResources\DeliveryPointFilterManager.cs:line 38 at Alto.Client.Controls.Dispatch.DispatchResources.UcDeliveryPoint.get_Title() in d:\Builds\45153\Alto\Alto.Prod\src\Alto\Alto.Client\Controls\Dispatch\DispatchResources\UcDeliveryPoint.cs:line 1520 at Alto.Client.Controls.Dispatch.DispatchResources.UcDeliveryPoint.updatePanelTitle() in d:\Builds\45153\Alto\Alto.Prod\src\Alto\Alto.Client\Controls\Dispatch\DispatchResources\UcDeliveryPoint.cs:line 543 at Alto.Client.Controls.Dispatch.DispatchResources.UcDeliveryPoint.onFilterChanged(Object sender, GridViewCollectionChangedEventArgs e) in d:\Builds\45153\Alto\Alto.Prod\src\Alto\Alto.Client\Controls\Dispatch\DispatchResources\UcDeliveryPoint.cs:line 547 at Telerik.WinControls.UI.GridViewCollectionChangedEventHandler.Invoke(Object sender, GridViewCollectionChangedEventArgs e) at Telerik.WinControls.UI.RadGridView.OnFilterChanged(Object sender, GridViewCollectionChangedEventArgs e) at Telerik.WinControls.UI.EventDispatcher.RaiseEvent[T](Object eventKey, Object sender, T args) at Telerik.WinControls.UI.GridViewFilterDescriptorCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs args) at Telerik.Collections.Generic.NotifyCollection`1.InsertItem(Int32 index, T item) at Telerik.WinControls.UI.GridViewFilterDescriptorCollection.InsertItem(Int32 index, FilterDescriptor item) at System.Collections.ObjectModel.Collection`1.Add(T item) at Telerik.WinControls.UI.GridViewDataColumn.SetFilterDescriptor(FilterDescriptor value) at Telerik.WinControls.UI.GridHeaderCellElement.filterPopup_FilterConfirmed(Object sender, EventArgs e) at Telerik.WinControls.UI.BaseFilterPopup.OnFilterConfirmed() at Telerik.WinControls.UI.RadListFilterPopup.OnButtonOkClick(EventArgs e) at Telerik.WinControls.UI.RadListFilterPopup.ButtonOK_Click(Object sender, EventArgs e) at Telerik.WinControls.RadElement.OnClick(EventArgs e) at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e) at Telerik.WinControls.UI.RadButtonElement.OnClick(EventArgs e) at Telerik.WinControls.RadElement.DoClick(EventArgs e) at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args) at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e) at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e) at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at Telerik.WinControls.RadControl.WndProc(Message& m) at Telerik.WinControls.UI.RadPopupControlBase.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ---- InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at Telerik.WinControls.UI.DataGroup.<GetEnumerator>d__0.MoveNext() at Telerik.WinControls.Data.GroupBuilder`1.Perform(IReadOnlyCollection`1 items, Int32 level, Group`1 parent) at Telerik.WinControls.Data.DataItemGroup`1.get_Groups() at Telerik.WinControls.UI.DataGroup.get_Groups() at Telerik.WinControls.UI.GridViewTemplate.InvalidateSummaryRowsCore(DataGroup group, Boolean invalidateChildren) at Telerik.WinControls.UI.GridViewTemplate.InvalidateSummaryRowsCore(DataGroup group, Boolean invalidateChildren) at Telerik.WinControls.UI.GridViewTemplate.InvalidateGroupSummaryRows(DataGroup group, Boolean invalidateChildren) at Telerik.WinControls.UI.GridViewTemplate.RefreshSummaryRowsInGroup(NotifyCollectionChangedEventArgs e) at Telerik.WinControls.UI.GridViewTemplate.RefreshAggregates(NotifyCollectionChangedEventArgs e) at Telerik.WinControls.UI.MasterGridViewTemplate.OnViewChanged(Object sender, DataViewChangedEventArgs e) at Telerik.WinControls.Data.RadDataView`1.RebuildData(Boolean notify) at Telerik.WinControls.Data.RadDataView`1.OnNotifyPropertyChanged(PropertyChangedEventArgs e) at Telerik.WinControls.Data.RadCollectionView`1.OnNotifyPropertyChanged(String propertyName) at Telerik.WinControls.UI.GridViewSortDescriptorCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs args) at Telerik.WinControls.UI.GridViewSortDescriptorCollection.RemoveItem(Int32 index) at Telerik.WinControls.UI.GridViewColumn.Sort(RadSortOrder sortOrder, Boolean multiSortMode) at Telerik.WinControls.UI.GridHeaderCellElement.Sort(RadSortOrder sortOrder) at Telerik.WinControls.UI.GridHeaderRowBehavior.OnMouseUp(MouseEventArgs e) at Telerik.WinControls.UI.BaseGridBehavior.OnMouseUp(MouseEventArgs e) at Telerik.WinControls.UI.RadGridView.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at Telerik.WinControls.RadControl.WndProc(Message& m) at Telerik.WinControls.UI.RadGridView.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
To reproduce: - Create a self reference grid and set the columns width so the horizontal scrollbar is visible. - Scroll to the right and filter by the last column, - Type a single character, the the edited cell is now changed. Workaround: class MyFilterCell : GridFilterCellElement { protected override Type ThemeEffectiveType { get { return typeof(GridFilterCellElement); } } public MyFilterCell(GridViewDataColumn column, GridRowElement row) : base(column, row) { } public override bool IsCompatible(GridViewColumn data, object context) { return false; } }
Use attached to reproduce. Workaround: this.LoadFieldList(hiddenGrid.MasterTemplate); this.FieldList.Add(new Telerik.Data.Expressions.ExpressionItem() { Name = "Test", Description = "Test", Syntax = "Test", Type = Telerik.Data.Expressions.ExpressionItemType.Field, Value = "Test" });
Use attached to reproduce. - Use a 125% and 150% monitor for reproducing. - This should be tested on Windows 10 1803 (Spring Update) as well. Workaround: private void RadGridView1_ColumnChooserCreated(object sender, Telerik.WinControls.UI.ColumnChooserCreatedEventArgs e) { e.ColumnChooser = new MyColumnChooser(this.radGridView1.MasterTemplate, radGridView1.GridViewElement); } public partial class MyColumnChooser : GridViewColumnChooser { public MyColumnChooser() { InitializeComponent(); } public MyColumnChooser(GridViewTemplate template, RadGridViewElement rootElement) : base(template, rootElement) { } SizeF oldDpi = new SizeF(1, 1); protected override void HandleDpiChanged() { base.HandleDpiChanged(); SizeF descale = new SizeF(1f / this.FormElement.DpiScaleFactor.Width, 1f / this.FormElement.DpiScaleFactor.Height); this.Scale(descale); var dpi = NativeMethods.GetMonitorDpi(Screen.FromRectangle(this.Bounds), NativeMethods.DpiType.Effective); if (oldDpi != dpi) { SizeF sz = new SizeF(dpi.Width / oldDpi.Width, dpi.Height / oldDpi.Height); this.Scale(dpi); } oldDpi = dpi; } }
Please refer to the attached sample project and follow the steps illustrated in the gif file. Note: the same behavior is observed with the CellValidating event in the new row. Workaround: use the RowValidating event instead: private void radGridView1_RowValidating(object sender, Telerik.WinControls.UI.RowValidatingEventArgs e) { if (e.Row is Telerik.WinControls.UI.GridViewNewRowInfo && e.Row.Cells["Id"].Value == null) { this.radGridView1.MasterView.TableAddNewRow.CancelAddNewRow(); this.radGridView1.CurrentRow = this.radGridView1.MasterView.TableAddNewRow; } }
NOTE: The CellValidating event is fired multiple times as well when you select a new tab in RadDock. There is a second project attached.