RadGridView - CustomGrouping event is not firing when you change some cell value and RadGridView is data bound via DataSource property. Workaround: 1.Subscribe to CellEndEdit event of RadGridView: this.radGridView1.CellEndEdit += new GridViewCellEventHandler(radGridView1_CellEndEdit); 2. Call Refresh method of MasterTemplate: void radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e) { this.radGridView1.MasterTemplate.Refresh(); }
Steps to reproduce: 1) Add RadGridView control 2) Add GridViewTextBoxColumn 2) Enable filtering: this.radGridView1.EnableFiltering = true; 3) Programmatically set filter descriptor: FilterDescriptor filter = new FilterDescriptor(); filter.PropertyName = "TextBoxColumn"; filter.Operator = FilterOperator.IsEqualTo; filter.IsFilterEditor = true; this.radGridView1.FilterDescriptors.Add(filter); Expected result: the default FilterDescriptor is changed from Contains to IsEqual Actual result: can not set the default FilterDescriptor from Contains to IsEqual operator to a TextBoxColumn Workaround: private void OnFilterExpressionChanged(object sender, FilterExpressionChangedEventArgs e) { GridViewTemplate owner = sender as GridViewTemplate; List<string> filterExpressions = new List<string>(); for (int i = 0; i < owner.FilterDescriptors.Count; i++) { FilterDescriptor descriptor = owner.FilterDescriptors[i]; string expression = null; CompositeFilterDescriptor compositeFilterDescriptor = descriptor as CompositeFilterDescriptor; if (compositeFilterDescriptor != null) { foreach (FilterDescriptor filterDescriptor in compositeFilterDescriptor.FilterDescriptors) { if (string.IsNullOrEmpty(filterDescriptor.PropertyName) || owner.Columns[filterDescriptor.PropertyName] == null) { continue; } } expression = CompositeFilterDescriptor.GetCompositeExpression(compositeFilterDescriptor); } else { if (string.IsNullOrEmpty(descriptor.PropertyName) || owner.Columns[descriptor.PropertyName] == null) { continue; } if (descriptor.Value == null && (descriptor.Operator == FilterOperator.IsNotEqualTo || descriptor.Operator == FilterOperator.IsEqualTo)) { expression = string.Empty; } else { expression = descriptor.Expression; } } if (!string.IsNullOrEmpty(expression)) { filterExpressions.Add(expression); } } string logicalOperator = (owner.FilterDescriptors.LogicalOperator == FilterLogicalOperator.And) ? " AND " : " OR "; string resultExpression = String.Join(logicalOperator, filterExpressions.ToArray()); e.FilterExpression = resultExpression; }
Steps to reproduce: 1) Add RadGridView control 2) Use GridViewDecimalColumn: DataTable customDataTable = new DataTable(); sampleDataTable.Columns.Add("Column name", typeof(double)); 3) Set the right-to-left property of the control to true: this.radGridView1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; 4) Set the following CellElement properties using CellFormatting event: void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) { if (e.CellElement is GridDataCellElement) { e.CellElement.RightToLeft = false; } } 5) Re-size the form manually until the horizontal scroll-bar disappears 6) Resize a GridHeaderCellElement in left direction and you will notice that the GridDataCellElements from this columns are resized to the right direction Whenever I'm trying to expand any column the header expands as expected but the column itself is expanding in the other direction so the headers and columns content are not aligned. Expected result: expand the column content properly Actual result: the GridDataCellElements from this columns are expanding incorrectly
Try to set the number of columns for the RadGridView to greater than 11230 columns, it throws "An item with the same key has already been added." exception. It does not happen when the code is run for the first time, but on any subsequent calls. Step to reproduce: 1. Create project with Windows form 2. Place RadGridView on form 3. Add following code: private void Form1_Load(object sender, EventArgs e) { radGridView1.VirtualMode = true; radGridView1.ColumnCount = 15000; } 4. Run application multiple times and you will get an exception at some moment during start up. NO WORKAROUND
Create a GridViewComboBoxColumn. When you select the field either by tab or single-click, it is no longer possible to select a value by pressing an alpha-numeric key on keyboard. You must first press the down-arrow key, or select a value with the mouse. Pressing the down-arrow shouldn't be required.
Steps to reproduce - by using the code below follow these steps 1) Enter some text in the first cell 2) In the first ComboBox cell ("city") type the beginning of the word, for example "L", then the dataSource gets filtered and contains only items begins with "L". 3) Move down to the second Item by the down arrow key and choose it by pressing tab key 4) Now the next cell becomes focused, type in capital "M" Result: Exception: IndexOutOfRangeException - "Index was outside the bounds of the array." DataTable dt = new DataTable(); dt.Columns.Add("name"); dt.Columns.Add("city", typeof(int)); dt.Columns.Add("role", typeof(int)); radGridView1.DataSource = dt;. radGridView1.Columns.RemoveAt(1); radGridView1.Columns.RemoveAt(1); DataTable dtCities = new DataTable(); dtCities.Columns.Add("id", typeof(int)); dtCities.Columns.Add("name"); dtCities.Rows.Add(1, "New York"); dtCities.Rows.Add(2, "London"); dtCities.Rows.Add(2, "Lisabon"); GridViewComboBoxColumn cityCol = new GridViewComboBoxColumn("city"); cityCol.DataSource = dtCities; cityCol.ValueMember = "id"; cityCol.DisplayMember = "name"; cityCol.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cityCol.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown; radGridView1.Columns.Add(cityCol); DataTable dtRoles = new DataTable(); dtRoles.Columns.Add("id", typeof(int)); dtRoles.Columns.Add("name"); dtRoles.Rows.Add(1, "Sales Man"); dtRoles.Rows.Add(2, "Manager"); GridViewComboBoxColumn roleCol = new GridViewComboBoxColumn("role"); roleCol.DataSource = dtRoles; roleCol.ValueMember = "id"; roleCol.DisplayMember = "name"; roleCol.AutoCompleteMode = AutoCompleteMode.SuggestAppend; roleCol.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown; radGridView1.Columns.Add(roleCol); WORKAROUND: Replace the editor with a new one to avoid reusage void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e) { if (e.EditorType == typeof(RadDropDownListEditor)) { e.Editor = new RadDropDownListEditor(); } }
Implement a property such as EncloseDataWithQuotes, which should get or set whether the exported data should contain quotes http://www.telerik.com/help/aspnet-ajax/p_telerik_web_ui_gridcsvsettings_enclosedatawithquotes.html
RADGRIDVIEW Extend it with the following localization string ids: – RadGridStringId.FilterMenuSelectionTrue – RadGridStringId.FilterMenuSelectionFalse Resolution: The mentioned strings are not predefined strings within RadGridView. They come from the values of the column being filtered (e.g. if the column is a checkbox column, all values are either True or False). Therefore, to localize them, you need to use a ValueConverter and override the conversion to string: this.radGridView1.Columns[3].DataTypeConverter = new MyConverter(); class MyConverter : BooleanConverter { public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { if (Object.Equals(value, "True") || (value is bool && (bool)value)) return "Yes"; if (Object.Equals(value, "False") || (value is bool && !(bool)value)) return "No"; } return base.ConvertTo(context, culture, value, destinationType); } }
RadGridView If FilteringMode is set to DisplayMember if one clicks in the ComboBoxColumn cell; the actual cell value goes blank. If FilteringMode is set to ValueMember the ComboBoxColumn behaves as expected. Workaround: Private Sub RadGridView1_CellEditorInitialized(sender As Object, e As GridViewCellEventArgs) Handles RadGridView1.CellEditorInitialized If e.ActiveEditor.GetType() Is GetType(RadDropDownListEditor) Then e.ActiveEditor.Value = e.Value End If End Sub
To reproduce - add Calculator column in the grid - set the EnterKeyMode to EnterMovesToNextRow - press enter when the cell is in edit mode. Workaround: -use custom GridDataRowBehavior like this: class MyNewEnterBehavior : GridDataRowBehavior { bool firstTime = true; protected override bool ProcessEnterKey(KeyEventArgs keys) { if (this.GridControl.IsInEditMode && this.GridControl.CurrentColumn is GridViewCalculatorColumn ) { if (firstTime) { firstTime = false; return false; } firstTime = true; return base.ProcessEnterKey(keys); } return base.ProcessEnterKey(keys); } }
To reproduce: - Create a grid with ColumnGroupsViewDefinition view( Column Groups View) - Set the AutoSizeColumnsMode to fill - Start the project and resize a column - Resize a column then minimize and maximize - The column have a different size Workaround: -Handle the form layout event like this: void Form1_Layout(object sender, LayoutEventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.radGridView1.GridElement.SuspendLayout(); } else { this.radGridView1.GridElement.ResumeLayout(true); } }
To reproduce: - Add CommandColumn to the grid - Observe the size of the button in the newrow row Workaround: - Add some padding in the cell formating event void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) { GridViewNewRowInfo row = e.Row as GridViewNewRowInfo; GridCommandCellElement cell = e.CellElement as GridCommandCellElement; if (row != null && cell != null) { cell.CommandButton.SetDefaultValueOverride(RadItem.MarginProperty, new System.Windows.Forms.Padding(0,0,1,0)); } }
To reproduce: Add a RadGridView with a GridViewComboBoxColumn and add 70000 items as datasource. You will notice that openning it is slow. Workaround: Use the following custom editor: public class MyEditor : RadDropDownListEditor { protected override RadElement CreateEditorElement() { return new MyEditorElement() { SyncSelectionWithText = false }; } } public class MyEditorElement : RadDropDownListEditorElement { public override void NotifyOwner(PopupEditorNotificationData notificationData) { if (notificationData.notificationContext == PopupEditorNotificationData.Context.TextChanged && !this.SyncSelectionWithText) { return; } base.NotifyOwner(notificationData); } }
To reproduce: Add a RadGridView and bind it to a DataTable. Subscribe to the TableElement's vertical scroll's ValueChanged event and add new data when the value reaches the maximum: private void RequestData(int startFrom, int count) { for (int i = 0; i < count; i++) { DataRow row = dt.NewRow(); row["ID"] = startFrom + i; dt.Rows.Add(row); } } private void VScrollBar_ValueChanged(object sender, EventArgs e) { if (dgwData.TableElement.VScrollBar.Value + dgwData.TableElement.VScrollBar.LargeChange >= dgwData.TableElement.VScrollBar.Maximum) { int maxVScrollBarBefore = dgwData.TableElement.VScrollBar.Maximum; dgwData.SelectionChanged -= dgwData_SelectionChanged; dgwData.TableElement.VScrollBar.ValueChanged -= VScrollBar_ValueChanged; RequestData(dt.Rows.Count, rowsToCharge); dgwData.SelectionChanged += dgwData_SelectionChanged; dgwData.TableElement.VScrollBar.ValueChanged += VScrollBar_ValueChanged; } } You will notice that when you use the mousewheel the scrollbar is being updated, but when you use the arrows it is not. Workaround: Invoke the UpdateScrollRange method of the TableElement's RowScroller after adding the new data: dgwData.TableElement.RowScroller.UpdateScrollRange();
To reproduce: Add a RadGridView and use the following code to populate it: for (int i = 0; i < 15; i++) { this.grid.Columns.Add(string.Format("Column {0}", i)); } for (int i = 0; i < this.grid.Columns.Count * 15; i++) { this.grid.Rows.AddNew(); }t Set the theme to TelerikMetroTouch. Scroll somewhere below the middle leave the scrollbar and leave the grid with the mouse. You will notice that the value of the scrollbar will change. Workaround: Subscribe to the RadPropertyChanging event of the TableElement: RadGridView1.TableElement.RadPropertyChanging += Property_Changing; void TableElement_RadPropertyChanging(object sender, RadPropertyChangingEventArgs args) { args.Cancel = args.Property == GridTableElement.RowHeightProperty || args.Property == GridTableElement.TableHeaderHeightProperty || args.Property == GridTableElement.GroupHeaderHeightProperty || args.Property == GridTableElement.FilterRowHeightProperty; }
To reproduce: Add a TabControl and two tabs. In the second tab add a RadGridView and in the Load event of the form set the SplitMode property of the grid. You will notice that it will not have effect until grouping or other similar action has been performed. Workaround: private void Form1_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("column1"); dt.Columns.Add("column2"); RadGridView1.DataSource = dt; this.RadGridView1.VisibleChanged += Visible_Changed; } private void Visible_Changed(object sender, EventArgs e) { if (this.RadGridView1.Visible & !this.RadGridView1.SplitMode.Equals(Telerik.WinControls.UI.RadGridViewSplitMode.Horizontal)) { RadGridView1.SplitMode = Telerik.WinControls.UI.RadGridViewSplitMode.Horizontal; } }
When adding a new row in underling data source and SelectLastAddedRow is true the newly added row is set as current but it is out of visible grid area.
Excel-like filtering throws an exception if there is a combo-box column, which contains values of types System.DBNull
If in underling datasource there are more than one field, which do not allow null values, trying to set them in DefaultValueNeeded event leads to exception "Column [columnName] does not allow nulls"
There is a weird behaviour when the row is in edit mode and the user clicks consecutively in a different ComboBoxColumn. The drop-down pop-up is shown bun immediately disappear if the previous cell was also from ComboBoxColumn.