GridViewMultiComboBoxColumn accepts only valid values according to the specified ValueMember. By entering "A" in the RadMultiColumnComboBoxElement editor in the filter cell, you can not filter the main RadGridView with all cells that starts with "A" as "A" is not a valid value according to the GridViewMultiComboBoxColumn.ValueMember property. Workaround: The ContextMenuOpening can be used to hide the irrelevant filter members
If you select a row and click with the right mouse button on the header row column, the context menu with Cut, Copy, Paste is shown. If you click the Cut item, it will cut only a single cell. However, if you Copy , the entire row will be copied. Workaround: public class CustomGrid : RadGridView { protected override RadGridViewElement CreateGridViewElement( { return new CustomRadGridViewElement(); } public override string ThemeClassName { get { return typeof(RadGridView).FullName; } } } public class CustomRadGridViewElement : RadGridViewElement { protected override MasterGridViewTemplate CreateTemplate() { return new CustomMasterGridViewTemplate(); } protected override Type ThemeEffectiveType { get { return typeof(RadGridViewElement); } } } public class CustomMasterGridViewTemplate : MasterGridViewTempla { public override void Cut() { this.BeginRowCopy(); this.Copy(); this.EndRowCopy(); foreach (GridViewRowInfo row in this.SelectedRows) { foreach (GridViewCellInfo cell in row.Cells) { cell.Value = null; } } } }
workaround: in the handler of the Load event explicitly set the scroll bar value to 0 this.radGridView1.TableElement.VScrollBar.Value = 0;
To reproduce: - Create a hierarchy and set the UseScrollbarsInHierarchy property to true. - Scroll by pressing the thumb in the child template. - The CellClick event is fired when the mouse is released. Workaround: void radGridView1_CellClick(object sender, GridViewCellEventArgs e) { if (e.Column != null) { Console.WriteLine("CellClick"); } }
To reproduce: - Add self-reference hierarchy and set a checkbox column as expander column - show the column at runtime upon button click. - You will notice that the layout is not updated properly. - If the column is small the checkboxes appear in the next cell. Workaround: Update the layout when the column is made visible: this.gridViewParameter.TableElement.UpdateView(); Set the ClipDrawing property of the checkbox cells to true: void gridViewParameter_CellFormatting(object sender, CellFormattingEventArgs e) { if (e.CellElement is GridCheckBoxCellElement) { e.CellElement.ClipDrawing = true; } else { e.CellElement.ResetValue(LightVisualElement.ClipDrawingProperty, Telerik.WinControls.ValueResetFlags.Local); } }
Steps to reproduce: 1. Add a GridViewDateTimeColumn to a grid. 2. Add rows where one or more rows should contain null as the columns value. 3. Sort the grid by the date time column. WORKAROUND: Create a custom RadGridDateTimeConverter and assign it as the column's date type converter: public class CustomRadGridDateTimeConverter : RadGridDateTimeConverter { public CustomRadGridDateTimeConverter(GridViewDateTimeColumn column) : base(column) { } public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(DateTime) && value == null) { return DateTime.MinValue; } return base.ConvertTo(context, culture, value, destinationType); } } this.radGridView1.Columns["DateTime"].DataTypeConverter = new CustomRadGridDateTimeConverter(this.radGridView1.Columns["DateTime"] as GridViewDateTimeColumn);
To reproduce: protected override void OnLoad(EventArgs e) { this.radGridView1.AllowAddNewRow = false; this.radGridView1.TableElement.RowHeight = 40; this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewTextBoxColumn id = new GridViewTextBoxColumn("ID"); id.IsVisible = false; GridViewTextBoxColumn parentID = new GridViewTextBoxColumn("ParentID"); parentID.IsVisible = false; GridViewTextBoxColumn name = new GridViewTextBoxColumn("Name"); GridViewDateTimeColumn date = new GridViewDateTimeColumn("Date"); GridViewTextBoxColumn type = new GridViewTextBoxColumn("Type"); GridViewTextBoxColumn size = new GridViewTextBoxColumn("Size"); size.FormatString = "{0} MB"; radGridView1.Columns.AddRange(new GridViewDataColumn[] { id, parentID, name, date, type, size }); this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "ID", "ParentID"); radGridView1.CellValueChanged += radGridView1_CellValueChanged; fillData(); } void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e) { fillData(); } private void fillData() { radGridView1.Rows.Clear(); radGridView1.Rows.Add(1, null, "Program Files", DateTime.Now.AddDays(-100), "Folder", 5120); radGridView1.Rows.Add(2, 1, "Visual Studio 2010", DateTime.Now.AddDays(-100), "Folder", 3220); radGridView1.Rows.Add(3, 2, "bin", DateTime.Now.AddDays(-100), "Folder", 3220); radGridView1.Rows.Add(4, 2, "READEME.txt", DateTime.Now.AddDays(-100), "Text Document", 3); radGridView1.Rows.Add(100, null, "Test.txt", DateTime.Now.AddDays(-10), "Text File", 0); radGridView1.Rows.Add(5, 1, "Telerik RadControls", DateTime.Now.AddDays(-10), "Folder", 3120); radGridView1.Rows.Add(6, 5, "Telerik UI for Winforms", DateTime.Now.AddDays(-10), "Folder", 101); radGridView1.Rows.Add(7, 5, "Telerik UI for Silverlight", DateTime.Now.AddDays(-10), "Folder", 123); radGridView1.Rows.Add(8, 5, "Telerik UI for WPF", DateTime.Now.AddDays(-10), "Folder", 221); radGridView1.Rows.Add(9, 5, "Telerik UI for ASP.NET AJAX", DateTime.Now.AddDays(-10), "Folder", 121); radGridView1.Rows.Add(10, 1, "Microsoft Office 2010", DateTime.Now.AddDays(-120), "Folder", 1230); radGridView1.Rows.Add(11, 10, "Microsoft Word 2010", DateTime.Now.AddDays(-120), "Folder", 1230); radGridView1.Rows.Add(12, 10, "Microsoft Excel 2010", DateTime.Now.AddDays(-120), "Folder", 1230); radGridView1.Rows.Add(13, 10, "Microsoft Powerpoint 2010", DateTime.Now.AddDays(-120), "Folder", 1230); radGridView1.Rows.Add(14, 1, "Debug Diagnostic Tools v1.0", DateTime.Now.AddDays(-400), "Folder", 2120); radGridView1.Rows.Add(15, 1, "Designer's 3D Tools", DateTime.Now.AddDays(-500), "Folder", 1120); radGridView1.Rows.Add(16, 1, "Communication", DateTime.Now.AddDays(-700), "Folder", 120); } Then start the application edit a value and click another cell. Workaround: - Enclose the rows addition within Begin/End update block.
Workaround: set the theme with ThemeResolutionService.ApplicationThemeName = "MyThemeName
To reproduce: radGridView1.DataSource = GetTable(); radGridView1.MultiSelect = true; radGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect; Then just select and deselect several cells without releasing the mouse button. Workaround: void radGridView1_MouseUp(object sender, MouseEventArgs e) { int endIndexCol = -1; int endIndexRow = -1; GridDataCellElement curentCell = radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridDataCellElement; if (curentCell != null) { endIndexCol = curentCell.ColumnInfo.Index; endIndexRow = curentCell.RowInfo.Index; } if (endIndexCol < startIndexCol) { int temp = endIndexCol; endIndexCol = startIndexCol; startIndexCol = temp; } if (endIndexRow < startIndexRow) { int temp = endIndexRow; endIndexRow = startIndexRow; startIndexRow = temp; } foreach (GridViewCellInfo cell in radGridView1.SelectedCells.ToList()) { if (cell.RowInfo.Index < startIndexRow || cell.RowInfo.Index > endIndexRow) { cell.IsSelected = false; } if (cell.ColumnInfo.Index < startIndexCol || cell.ColumnInfo.Index > endIndexCol) { cell.IsSelected = false; } } } int startIndexCol = -1 ; int startIndexRow = -1; void radGridView1_MouseDown(object sender, MouseEventArgs e) { GridDataCellElement curentCell = radGridView1.ElementTree.GetElementAtPoint(e.Location) as GridDataCellElement; if (curentCell != null) { startIndexCol = curentCell.ColumnInfo.Index; startIndexRow = curentCell.RowInfo.Index; } }
To reproduce: GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1); spreadExporter.RunExport(@"C:\exportedFile.xlsx"); Workaround: GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1); spreadExporter.RunExport(@"C:\exportedFile.xlsx", new SpreadExportRenderer()); Alternatively you can set the Copy Local property of the TelerikExport assembly to true.
To reproduce: - Add GridViewDateTimeColumn. - Set the editor properties: private void radGridView_VehicleAbsenceTime_CellEditorInitialized(object sender, GridViewCellEventArgs e) { RadDateTimeEditor lEditor = radGridView_VehicleAbsenceTime.ActiveEditor as RadDateTimeEditor; if (lEditor != null) { RadDateTimeEditorElement editorElement = (RadDateTimeEditorElement)lEditor.EditorElement; editorElement.Format = DateTimePickerFormat.Custom; editorElement.CustomFormat = "dd.MM.yyyy HH:mm"; editorElement.ShowUpDown = true; } } - Start the application scroll to the bottom and start editing.
To reproduce: 1. Add a GridViewDecimalColumn to a grid with data type int, float, decimal, double, real, money. 2. Add few rows where one of rows contains null value. 3. Run the form. Sort the grid by any of column with null data and you will see that the exception is thrown. Workaround: 1. Use custom TypeConverter public class CustomFloatConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(float); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(float) && (value == null || value is DBNull)) { return float.MinValue; } return value; } } public class CustomIntConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(int); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(int) && (value == null || value is DBNull)) { return int.MinValue; } return value; } } public class CustomDecimalConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(decimal); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(decimal) && (value == null || value is DBNull)) { return decimal.MinValue; } return value; } } public class CustomDoubleConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(double); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(double) && (value == null || value is DBNull)) { return double.MinValue; } return value; } } public class CustomSingleConverter : TypeConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(Single); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(Single) && (value == null || value is DBNull)) { return Single.MinValue; } return value; } } 2. Apply the converter to GridViewDecimalColumn this.radGridView2.Columns["ColumnReal"].DataTypeConverter = new CustomSingleConverter(); this.radGridView2.Columns["ColumnFloat"].DataTypeConverter = new CustomDoubleConverter(); this.radGridView2.Columns["ColumnDecimal"].DataTypeConverter = new CustomDecimalConverter(); this.radGridView2.Columns["ColumnInt"].DataTypeConverter = new CustomIntConverter(); this.radGridView2.Columns["ColumnNumeric"].DataTypeConverter = new CustomDecimalConverter(); this.radGridView2.Columns["ColumnMoney"].DataTypeConverter = new CustomDecimalConverter();
How to reproduce: Public Class Form1 Sub New() InitializeComponent() Dim dataTable As New DataTable dataTable.Columns.Add("Id", GetType(Integer)) dataTable.Columns.Add("Name", GetType(String)) dataTable.Columns.Add("IsValid", GetType(Boolean)) For i As Integer = 0 To 40 dataTable.Rows.Add(i, "Name " & i, i Mod 2 = 0) Next Me.RadGridView1.DataSource = dataTable Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill Me.RadGridView1.TableElement.RowHeight = 20 End Sub Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click Me.RadGridView1.PrintPreview() End Sub End Class Workaround: before printing increase the row height or set RadGridView.AutoSizeRows = True Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click 'Me.RadGridView1.TableElement.RowHeight = 24 Me.RadGridView1.AutoSizeRows = True Me.RadGridView1.PrintPreview() End Sub
1. Use the following code snippet: public Form1() { InitializeComponent(); this.radGridView1.MasterTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.MasterTemplate.EnableAlternatingRowColor = true; this.radGridView1.MasterTemplate.EnableFiltering = true; this.radGridView1.MasterTemplate.MultiSelect = true; for (int i = 0; i < 3; i++) { this.radGridView1.Columns.Add("Col"+i); } radGridView1.Rows.Add("test1", "test1", "test1"); radGridView1.Rows.Add("test2", "test2", "test2"); radGridView1.Rows.Add("test3", "test3", "test3"); radGridView1.Rows.Add("test4", "test4", "test4"); radGridView1.Rows.Add("test5", "test5", "test5"); } 2. Quickly click around the cells a few times, making sure to drag your mouse a bit to select a few rows on some of the clicks. Then quickly click the filter. (sometimes it takes a few tries) Workaround: use custom GridFilterRowBehavior BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewFilteringRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewFilteringRowInfo), new CustomGridFilterRowBehavior()); public class CustomGridFilterRowBehavior : GridFilterRowBehavior { protected override bool ProcessMouseSelection(Point mousePosition, GridCellElement currentCell) { return false; } }
Workaround: public Form1() { InitializeComponent(); this.radGridView1.CreateCell += radGridView1_CreateCell; GridViewCheckBoxColumn checkBoxColumn = new GridViewCheckBoxColumn("CheckBoxColumn"); checkBoxColumn.EnableHeaderCheckBox = false; checkBoxColumn.ThreeState = true; checkBoxColumn.EditMode = EditMode.OnValueChange; radGridView1.MasterTemplate.Columns.Add(checkBoxColumn); radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; for (int i = 0; i < 20; i++) { this.radGridView1.Rows.Add(false); } } private void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e) { if (e.CellType == typeof(GridCheckBoxHeaderCellElement)) { CustomGridCheckBoxHeaderCellElement headerCell = new CustomGridCheckBoxHeaderCellElement(e.Column, e.Row); e.CellElement = headerCell; } } public class CustomGridCheckBoxHeaderCellElement : GridHeaderCellElement { public CustomGridCheckBoxHeaderCellElement(GridViewColumn column, GridRowElement row) : base(column, row) { } protected override Type ThemeEffectiveType { get { return typeof(GridHeaderCellElement); } } RadCheckBoxElement cb = new RadCheckBoxElement(); protected override void CreateChildElements() { base.CreateChildElements(); this.Children.Add(cb); cb.IsThreeState = true; cb.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off; cb.ToggleStateChanged += CheckBox_ToggleStateChanged; } bool boolValue = false; public override void SetContent() { base.SetContent(); if (!flag) { bool atLeastOneTrue = false; bool atLeastOneFalse = false; foreach (GridViewRowInfo r in this.GridViewElement.Template.Rows) { if (r.Cells[0].Value != null) { if (atLeastOneTrue && atLeastOneFalse) { break; } boolValue = (bool)r.Cells[0].Value; if (boolValue) { atLeastOneTrue = true; } else { atLeastOneFalse = true; } } else { atLeastOneFalse = true; } } if (atLeastOneFalse && atLeastOneTrue) { cb.ToggleStateChanged -= CheckBox_ToggleStateChanged; cb.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Indeterminate; cb.ToggleStateChanged += CheckBox_ToggleStateChanged; } else if (atLeastOneFalse == true) { cb.ToggleStateChanged -= CheckBox_ToggleStateChanged; cb.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off; cb.ToggleStateChanged += CheckBox_ToggleStateChanged; } else if (atLeastOneTrue == true) { cb.ToggleStateChanged -= CheckBox_ToggleStateChanged; cb.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On; cb.ToggleStateChanged += CheckBox_ToggleStateChanged; } } } bool flag = false; private void CheckBox_ToggleStateChanged(object sender, StateChangedEventArgs args) { cb.ToggleStateChanged -= CheckBox_ToggleStateChanged; flag = true; if (args.ToggleState == Telerik.WinControls.Enumerations.ToggleState.Indeterminate) { cb.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off; } ToggleStateForChildRows(args.ToggleState, this.GridControl); flag = false; cb.ToggleStateChanged += CheckBox_ToggleStateChanged; } private void ToggleStateForChildRows(Telerik.WinControls.Enumerations.ToggleState toggleState, RadGridView radGridView) { foreach (GridViewRowInfo r in radGridView.Rows) { r.Cells[0].Value = toggleState == Telerik.WinControls.Enumerations.ToggleState.On; } } }
http://screencast.com/t/mZDwbWS8 WORKAROUND: Set the UseCompatibleTextRendering property of RadGridView to false.
Note: if you try to clear the initial minimum value by pressing Backspace or Delete key, the editor value reappears. To reproduce: GridViewDecimalColumn decimalColumn2 = new GridViewDecimalColumn("Col2"); decimalColumn2.FieldName = "Number"; decimalColumn2.Minimum = -50; decimalColumn2.Maximum = 50; radGridView2.MasterTemplate.Columns.Add(decimalColumn2); radGridView2.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView2.EnableFiltering = true; Workaround: private void radGridView2_EditorRequired(object sender, Telerik.WinControls.UI.EditorRequiredEventArgs e) { if (e.EditorType == typeof(GridSpinEditor)) { e.EditorType = typeof(CustomEditor); } } public class CustomEditor : GridSpinEditor { protected override Telerik.WinControls.RadElement CreateEditorElement() { return new CustomElement(); } } public class CustomElement : GridSpinEditorElement { protected override decimal GetValueFromText() { if (string.IsNullOrEmpty(this.Text)) { return this.MinValue; } return base.GetValueFromText(); } }
How to reproduce: public Form1() { InitializeComponent(); string newLine = "line"; string multiLine = "line"; for (int i = 0; i < 10; i++) { radGridView1.Rows.Add(newLine, multiLine); multiLine += Environment.NewLine + multiLine; } this.Load += Form1_Load; } Workaround: private void Form1_Load(object sender, EventArgs e) { this.radGridView1.Columns[1].PropertyChanged += item_PropertyChanged; } private void item_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "IsVisible") { this.radGridView1.TableElement.ScrollTo(0, 0); } }
Steps to reproduce: 1. Add a GridViewDateTimeColumn to a grid. 2. Add rows where one or more rows should contain null as the columns value. 3. Sort the grid by the date time column. WORKAROUND: Create a custom RadGridDateTimeConverter and assign it as the column's date type converter: public class CustomRadGridDateTimeConverter : RadGridDateTimeConverter { public CustomRadGridDateTimeConverter(GridViewDateTimeColumn column) : base(column) { } public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(DateTime) && value == null) { return DateTime.MinValue; } return base.ConvertTo(context, culture, value, destinationType); } } this.radGridView1.Columns["DateTime"].DataTypeConverter = new CustomRadGridDateTimeConverter(this.radGridView1.Columns["DateTime"] as GridViewDateTimeColumn);