1 .Add RadgridView to Form 2. Set "AllowSearchRow" property to True 3. Add a row and place the word "Gießen" (name of a city) in a column 4. When the program is running type "Giessen" in the AutoSearch Row. After the "n" an ArgumentException is thrown.
To reproduce: public Form1() { InitializeComponent(); List<Item> items = new List<Item>(); items.Add(new Item(1,"sample")); items.Add(new Item(2, null)); items.Add(new Item(3, "sample2")); this.radGridView1.DataSource = items; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.EnableFiltering = true; this.radGridView1.ShowFilteringRow = false; this.radGridView1.ShowHeaderCellButtons = true; } public class Item { public int Id { get; set; } public string Description { get; set; } public Item(int id, string description) { this.Id = id; this.Description = description; } } Workaround: If possible, instead of using null value, use empty string. If not possible, you will have to employ 3 classes - MyFilterMenuTreeElement, MyFilterMenuTreeItem, MyListFilterPopup. The classes are provided in the attached project RadGridViewFiltering.zip. Once you add the classes to your project, all you have to do is to replace the default popup with the new one, in the FilterPopupRequired handler: private void RadGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e) { if (e.FilterPopup is RadListFilterPopup) { e.FilterPopup = new MyListFilterPopup(e.Column); } } The approach is also demonstrated in the attached project.
Workaround: public Form1() { InitializeComponent(); this.radGridView1.TableElement.VScrollBar.ValueChanged += VScrollBar_ValueChanged; } private void VScrollBar_ValueChanged(object sender, EventArgs e) { int maxValue = this.radGridView1.TableElement.VScrollBar.Maximum - this.radGridView1.TableElement.VScrollBar.LargeChange; if (maxValue < 0) { this.radGridView1.TableElement.VScrollBar.Value = 0; } else if (this.radGridView1.TableElement.VScrollBar.Value > maxValue) { this.radGridView1.TableElement.VScrollBar.Value = maxValue; } }
To reproduce: - Set the first column header text to "+R/S"; - Export the grid with spread export. Workaround: class MySpreadExportRenderer : SpreadExportRenderer { public override void SetCellSelectionValue(string text) { if (text == "+R/S") { var cellSelection = typeof(SpreadExportRenderer).GetField("cellSelection", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this) as CellSelection; CellRange range = cellSelection.CellRanges.ElementAtOrDefault(0); CellValueFormat cvf = new CellValueFormat("@"); var worksheet = typeof(SpreadExportRenderer).GetField("worksheet", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this) as Worksheet; worksheet.Cells[range.FromIndex.RowIndex, range.FromIndex.ColumnIndex].SetFormat(cvf); } base.SetCellSelectionValue(text); } }
To reproduce: 1. Add a RadGridView and a RadButton. 2. Use the following code snippet: Public Class Form1 Private myList As New List(Of MyObject) Sub New() InitializeComponent() PopulateGrid(300) End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click PopulateGrid(100) End Sub Private Sub PopulateGrid(count As Integer) myList.Clear() Me.RadGridView1.DataSource = Nothing For index = 1 To count myList.Add(New MyObject(index, "Item" & index)) Next Me.RadGridView1.DataSource = myList End Sub Public Class MyObject Public Sub New(ByVal myInt As Integer, ByVal myString As String) _myInt = myInt _myString = myString End Sub Private _myInt As Integer Public Property MyInt() As Integer Get Return _myInt End Get Set(ByVal value As Integer) _myInt = value End Set End Property Private _myString As String Public Property MyString() As String Get Return _myString End Get Set(ByVal value As String) _myString = value End Set End Property End Class End Class 3. Select the last item 4. Click the button Workaround: use BindingList instead of List
To reproduce: 1. Drag a grid from the Toolbox and drop it onto the form 2. Open the designer 3. Set the RadGridView.AutoGenerateHierarchy property to true. 4. Open the smart tag and set the DataSource property. As a result the grid templates and relations will be created. 5. Try to open the Property Builder. It opens successfully. 6. Close the Property Builder and add a new templated from the smart tag. 7. If you try to open the Property Builder again you will obtain the error. Please refer o the attached gif file illustrating the behavior. Workaround: set the AutoGenerateHierarchy to false in order to open the Property Builder.
To reproduce: - Group the grid first. Make sure there are enough rows for two pages. - Set the AutoSizeRows property to true. Workaround: Set AutoSizeRows to false while printing.
Changing the DataSource or scrolling are slow. Create a grid with more than 20 columns and add 5K rows for example. Maximize the form and try to scroll with mouse wheel. You will notice that the scrolling performance is worse compared to the normal state of the form with less visible visual elements. Workaround: this.radGridView1.EnableFastScrolling = true; and use the scrollbar's thumb Second workaround: use paging: https://docs.telerik.com/devtools/winforms/gridview/paging/overview Thus, you will display as many rows as possible to display on the screen per page. Instead of scrolling, you will navigate through pages.
"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
To reproduce: 1. Bind RadGridView to a collection of business objects where one of the properties is Nullable<DateTime>. 2. Leave one of the items with an empty date (null value). 3. Copy the entire row and try to paste in one of the grid rows. The FormatException is thrown. Sub New() InitializeComponent() Dim items As New List(Of Item) items.Add(New Item(1, DateTime.Now.AddDays(2), "Item1")) items.Add(New Item(2, Nothing, "Item2")) items.Add(New Item(3, DateTime.Now.AddDays(4), "Item3")) items.Add(New Item(4, DateTime.Now.AddDays(5), "Item4")) Me.RadGridView1.DataSource = items Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill End Sub Public Class Item Private _id As Integer Private _createdOn As Nullable(Of DateTime) Private _title As String Public Sub New(id As Integer, createdOn As Nullable(Of DateTime), title As String) Me._id = id Me._createdOn = createdOn Me._title = title End Sub Public Property Id() As Integer Get Return _id End Get Set(ByVal value As Integer) _id = value End Set End Property Public Property CreatedOn() As Nullable(Of DateTime) Get Return _createdOn End Get Set(ByVal value As Nullable(Of DateTime)) _createdOn = value End Set End Property Public Property Title() As String Get Return _title End Get Set(ByVal value As String) _title = value End Set End Property End Class Workaround: use a TypeConverter Sub New() InitializeComponent() Dim items As New List(Of Item) items.Add(New Item(1, DateTime.Now.AddDays(2), "Item1")) items.Add(New Item(2, Nothing, "Item2")) items.Add(New Item(3, DateTime.Now.AddDays(4), "Item3")) items.Add(New Item(4, DateTime.Now.AddDays(5), "Item4")) Me.RadGridView1.DataSource = items Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill DirectCast(Me.RadGridView1.Columns(1), GridViewDateTimeColumn).DataTypeConverter=New NullableDateTimeConverter() End Sub Public Class NullableDateTimeConverter Inherits TypeConverter Public Overrides Function CanConvertFrom(ByVal context As ITypeDescriptorContext, ByVal sourceType As Type) As Boolean Return sourceType.Equals(GetType(String)) End Function Public Overrides Function ConvertFrom(ByVal context As ITypeDescriptorContext, ByVal culture As CultureInfo, ByVal value As Object) As Object Dim parsedDate As DateTime If DateTime.TryParse(value.ToString(), parsedDate) Then Return parsedDate End If Return Nothing End Function End Class Public Class Item Private _id As Integer Private _createdOn As Nullable(Of DateTime) Private _title As String Public Sub New(id As Integer, createdOn As Nullable(Of DateTime), title As String) Me._id = id Me._createdOn = createdOn Me._title = title End Sub Public Property Id() As Integer Get Return _id End Get Set(ByVal value As Integer) _id = value End Set End Property Public Property CreatedOn() As Nullable(Of DateTime) Get Return _createdOn End Get Set(ByVal value As Nullable(Of DateTime)) _createdOn = value End Set End Property Public Property Title() As String Get Return _title End Get Set(ByVal value As String) _title = value End Set End Property End Class
To reproduce: use DataAccess to connect to Northwind.Customer table: public Form1() { InitializeComponent(); EntitiesModel1 context = new EntitiesModel1(); var query = (from c in context.Customers where c.CustomerID.Contains("f") select c).ToList(); this.radGridView1.DataSource = query; SortDescriptor descriptor = new SortDescriptor(); descriptor.PropertyName = "CustomerID"; descriptor.Direction = ListSortDirection.Ascending; this.radGridView1.MasterTemplate.SortDescriptors.Add(descriptor); this.radGridView1.CurrentRow = this.radGridView1.Rows.Last(); } Run the project and press the Delete key several times. Workaround: use BindingSource as RadGridView.DataSource: BindingSource bs = new BindingSource(); bs.DataSource = query; this.radGridView1.DataSource = bs;
To reproduce: Sub New() InitializeComponent() Dim dt As New DataTable() dt.Columns.Add("Name", GetType(String)) dt.Columns.Add("Price", GetType(Decimal)) dt.Columns.Add("Id", GetType(Integer)) dt.Columns.Add("ActivatedOn", GetType(DateTime)) For i As Integer = 0 To 4 dt.Rows.Add("Item" & i, i * 0.25, i, DateTime.Now.AddHours(i)) Next Me.RadGridView1.DataSource = dt Me.RadGridView1.Columns("Id").[ReadOnly] = True Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill AddHandler Me.RadGridView1.DefaultValuesNeeded, AddressOf radGridView1_DefaultValuesNeeded Me.RadGridView1.NewRowEnterKeyMode = RadGridViewNewRowEnterKeyMode.EnterMovesToLastAddedRow End Sub Private Sub radGridView1_DefaultValuesNeeded(sender As Object, e As GridViewRowEventArgs) e.Row.Cells("Id").Value = Me.radGridView1.Rows.Count e.Row.Cells("ActivatedOn").Value = DateTime.Now End Sub Select the read-only cell inside the new row and press Enter. You will notice that two duplicated rows are added. Workaround: handle the RadGridView.PreviewKeyDown event and change the current column to one that is not read-only AddHandler Me.RadGridView1.PreviewKeyDown, AddressOf GridPreviewKeyDown Private Sub GridPreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) If e.KeyCode = Keys.Enter Then Me.RadGridView1.CurrentColumn = Me.RadGridView1.Columns(0) Me.RadGridView1.BeginEdit() End If End Sub
Example : if we have 5 rows in the grid and if we copy 10 rows from excel and paste in first row, only first 5 records gets pasted and remaining 5 would be ignored.
To reproduce: public Form1() { InitializeComponent(); List<Item> items = new List<Item>(); for (int i = 1; i <= 10; i++) { items.Add(new Item(i, "Product" + i, 0.25m * i, i)); } this.radGridView1.DataSource = items; GridViewDecimalColumn col = new GridViewDecimalColumn("Calculated Column"); col.Expression = "Quantity*Price/100"; this.radGridView1.Columns.Add(col); this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; } public class Item { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public int Quantity { get; set; } public Item(int id, string name, decimal price, int quantity) { this.Id = id; this.Name = name; this.Price = price; this.Quantity = quantity; } } MemoryStream s = new MemoryStream(); private void radButton1_Click(object sender, EventArgs e) { s = new MemoryStream(); this.radGridView1.SaveLayout(s); } private void radButton2_Click(object sender, EventArgs e) { this.radGridView1.LoadLayout(s); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { s.Close(); } Workaround: before loading the layout, clear the columns
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.Load += Form1_Load; } private void Form1_Load(object sender, EventArgs e) { this.radGridView1.SynchronizeCurrentRowInSplitMode = true; this.radGridView1.SplitMode = Telerik.WinControls.UI.RadGridViewSplitMode.Vertical; } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Age", typeof(int)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 100; i++) { dt.Rows.Add("Name " + i, i, DateTime.Now.AddMinutes(i), i % 2 == 0 ? true : false); } return dt; } } Workaround: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); this.radGridView1.ViewDefinition = new SplitViewDefintion(); this.Load += Form1_Load; } private void Form1_Load(object sender, EventArgs e) { this.radGridView1.SynchronizeCurrentRowInSplitMode = true; this.radGridView1.SplitMode = Telerik.WinControls.UI.RadGridViewSplitMode.Vertical; } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Age", typeof(int)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 100; i++) { dt.Rows.Add("Name " + i, i, DateTime.Now.AddMinutes(i), i % 2 == 0 ? true : false); } return dt; } } public class SplitViewDefintion : TableViewDefinition { public override IRowView CreateViewUIElement(GridViewInfo viewInfo) { return new MyGridTableElement(); } } public class MyGridTableElement : GridTableElement { protected override RadScrollBarElement CreateScrollBarElement() { return new MyRadScrollbarElement(); } } public class MyRadScrollbarElement : RadScrollBarElement { protected override Type ThemeEffectiveType { get { return typeof(RadScrollBarElement); } } protected override void OnMouseDown(MouseEventArgs e) { if (Cursor.Current == Cursors.SizeWE || Cursor.Current == Cursors.SizeNS) { return; } base.OnMouseDown(e); } }
Currently, in order to display the "Deleter Row" context menu item, you should set both properties, AllowEditRow and AllowDeleteRow, to true. However, if you use the Delete key, it will remove the row if only the AllowDeleteRow property is set to true.
To reproduce: DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Rows.Add(1, new string('G', 32001)); this.radGridView1.DataSource = dt; this.radGridView1.PrintPreview(); Workaround: this.radGridView1.PrintCellFormatting+=radGridView1_PrintCellFormatting; private void radGridView1_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e) { e.PrintCell.Text = e.PrintCell.Text.Substring(0,Math.Min(e.PrintCell.Text.Length, 32000)); }
To reproduce: change the value for a GridCheckBoxCellElement. The editor is not active. However, if you click again over the current cell, the editor will be activated. Workaround: use a custom row behavior to close the editor: //register the custom row behavior BaseGridBehavior gridBehavior = sourceRadGridView.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomGridDataRowBehavior()); public class CustomGridDataRowBehavior : GridDataRowBehavior { public override bool OnMouseUp(MouseEventArgs e) { bool result = base.OnMouseUp(e); if (this.MasterTemplate.CurrentColumn is GridViewCheckBoxColumn ) { this.GridViewElement.EndEdit(); } return result; } }