To reproduce: GridViewMultiComboBoxColumn supplierColumn = new GridViewMultiComboBoxColumn(); supplierColumn.SyncSelectionWithText = true; supplierColumn.Name = "SupplierColumn"; supplierColumn.HeaderText = "Supplier"; supplierColumn.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown; supplierColumn.AutoCompleteMode = AutoCompleteMode.Append; supplierColumn.DataSource = this.suppliersBindingSource; supplierColumn.ValueMember = "SupplierID"; supplierColumn.DisplayMember = "ContactName"; supplierColumn.FieldName = "SupplierID"; supplierColumn.Width = 200; this.radGridView1.Columns.Add(supplierColumn); Select the new row and try to enter some text that is not valid and press Enter. You will notice the new row is added with the last valid auto-completed value. Workaround: cancel the UserAddingRow event if the entered text is not valid.
To reproduce: this.radGridView1.DataSource = this.ordersBindingSource; GridViewDateTimeColumn col = this.radGridView1.Columns["OrderDate"] as GridViewDateTimeColumn; col.ExcelExportType = DisplayFormatType.GeneralDate; col.ExcelExportFormatString = "dd-MMM-yy"; private void radButton1_Click(object sender, EventArgs e) { SpreadExport spreadExporter = new SpreadExport(radGridView1); spreadExporter.RunExport(@"..\..\..\exportedFileQ12015.xlsx"); Process.Start(@"..\..\..\exportedFileQ12015.xlsx"); } Workaround: private void radButton1_Click(object sender, EventArgs e) { SpreadExport spreadExporter = new SpreadExport(radGridView1); spreadExporter.CellFormatting += spreadExporter_CellFormatting; spreadExporter.RunExport(@"..\..\..\exportedFileQ12015.xlsx"); Process.Start(@"..\..\..\exportedFileQ12015.xlsx"); } private void spreadExporter_CellFormatting(object sender, Telerik.WinControls.UI.Export.SpreadExport.CellFormattingEventArgs e) { if (e.GridColumnIndex == 3 && e.GridCellInfo.Value is DateTime) { CellValueFormat cvf = new CellValueFormat("dd-MMM-yy"); e.CellSelection.SetFormat(cvf); } }
To reproduce: 1. Populate RadGridView with data 2. Export the grid by using the SpreadExport 3. Open the produce Excel file and select some cells to generate a chart in Excel. You will notice that it is not possible to create a complete chart with the selected data. Workaround: use the ExportToExcelML >> http://www.telerik.com/help/winforms/gridview-exporting-data-export-to-excel-via-excelml-format.html
To reproduce: - Set the cell's BackColor in an entire column. - Set the cell's Forecolor in another column. - Change the grid size to the columns are hidden and then shown again. Workaround: Change similar properties for all the cells where the Style property is used or use CellFormatting.
To reproduce: - Add two child templates to a grid. - Add summary rows to both of them - Change the value of the child template. Workaround: - Clear and add back the summary rows when a value in the child template is changed.
When the RadGridView.EnabledPaging property is set to true, the user should be allowed to specify not only the PageSize,but also the PagesCount for example. Afterwards, it would be convenient to have an event similar to RowSourceNeeded in order to load pages data on demand.
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.customersTableAdapter.Fill(this.nwindDataSet.Customers); this.radGridView1.DataSource = this.customersBindingSource; this.radGridView1.BestFitColumns(Telerik.WinControls.UI.BestFitColumnMode.AllCells); this.radGridView1.AllowSearchRow = true; } Workaround: private void Form1_Load(object sender, EventArgs e) { RadDragDropService svc = this.radGridView1.GridViewElement.GetService<RadDragDropService>(); svc.PreviewDragDrop += svc_PreviewDragDrop; } private void svc_PreviewDragDrop(object sender, RadDropEventArgs e) { GridViewSearchRowInfo.Cancel = true; }
To reproduce: BindingList<Item> items = new BindingList<Item>(); public Form1() { InitializeComponent(); Item dataItem1 = new Item(1); dataItem1.Name = "Cat"; dataItem1.GroupName = "Animal"; dataItem1.GroupSortPriority = 2; items.Add(dataItem1); Item dataItem2 = new Item(2); dataItem2.Name = "Kitten"; dataItem2.GroupName = "Animal"; dataItem2.GroupSortPriority = 2; dataItem2.ParentIndex = 1; items.Add(dataItem2); Item dataItem3 = new Item(3); dataItem3.Name = "Trout"; dataItem3.GroupName = "Fish"; dataItem3.GroupSortPriority = 1; items.Add(dataItem3); radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, "Index", "ParentIndex"); radGridView1.DataSource = items; } private void ExpandSomeGroups() { foreach (DataGroup group in radGridView1.Groups) { if (group.GroupRow.HeaderText.Contains("Animal")) { if (group.IsExpanded) { group.Collapse(false); } else { group.Expand(true); } } } } public class Item { public Item(int index) { Index = index; } public int Index { get; private set; } public int ParentIndex { get; set; } public string Name { get; set; } public string GroupName { get; set; } public int GroupSortPriority { get; set; } } private void Form1_Load(object sender, EventArgs e) { GroupDescriptor descriptor = new GroupDescriptor(); descriptor.GroupNames.Add("GroupName", ListSortDirection.Ascending); radGridView1.GroupDescriptors.Add(descriptor); ExpandSomeGroups(); } You will notice that the "Animal" group is not expanded. However, if you remove the self-referencing hierarchy, the "Animal" group will be expanded.
To reproduce: BindingList<Item> items = new BindingList<Item>(); public Form1() { InitializeComponent(); Item dataItem1 = new Item(1); dataItem1.Name = "Cat"; dataItem1.GroupName = "Animal"; dataItem1.GroupSortPriority = 2; items.Add(dataItem1); Item dataItem2 = new Item(2); dataItem2.Name = "Kitten"; dataItem2.GroupName = "Animal"; dataItem2.GroupSortPriority = 2; dataItem2.ParentIndex = 1; items.Add(dataItem2); Item dataItem3 = new Item(3); dataItem3.Name = "Trout"; dataItem3.GroupName = "Fish"; dataItem3.GroupSortPriority = 1; items.Add(dataItem3); radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, "Index", "ParentIndex"); radGridView1.DataSource = items; } public class Item { public Item(int index) { Index = index; } public int Index { get; private set; } public int ParentIndex { get; set; } public string Name { get; set; } public string GroupName { get; set; } public int GroupSortPriority { get; set; } } public class GridGroupComparer : IComparer<Group<GridViewRowInfo>> { public GridGroupComparer() { } public int Compare( Group<GridViewRowInfo> x, Group<GridViewRowInfo> y) { if (null == x.Key || null == y.Key) return 1; GridViewRowInfo xGridViewRowInfo = x.DefaultIfEmpty(null).First(); GridViewRowInfo yGridViewRowInfo = y.DefaultIfEmpty(null).First(); if (null == xGridViewRowInfo || null == yGridViewRowInfo) return x.Key.GetHashCode().CompareTo(y.Key.GetHashCode()); Item xGridRowDataItem = xGridViewRowInfo.DataBoundItem as Item; Item yGridRowDataItem = yGridViewRowInfo.DataBoundItem as Item; if (null == xGridRowDataItem || null == yGridRowDataItem) return x.Key.GetHashCode().CompareTo(y.Key.GetHashCode()); if (xGridRowDataItem.GroupSortPriority > yGridRowDataItem.GroupSortPriority) return 1; if (xGridRowDataItem.GroupSortPriority < yGridRowDataItem.GroupSortPriority) return -1; return 0; } } private void Form1_Load(object sender, EventArgs e) { GridGroupComparer groupComparer = new GridGroupComparer(); radGridView1.MasterTemplate.GroupComparer = groupComparer; GroupDescriptor descriptor = new GroupDescriptor(); descriptor.GroupNames.Add("GroupName", ListSortDirection.Ascending); radGridView1.GroupDescriptors.Add(descriptor); } If you remove the Self-referencing hierarchy, you will notice that the GroupComparer is respected.
To reproduce: use the following code snippet and perform the steps illustrated on the attached gif file: http://www.telerik.com/help/winforms/gridview-filtering-excel-like-filtering.html public Form1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Name", typeof(string)); DateTime date; for (int i = 0; i < 5; i++) { date = DateTime.Today.AddDays(i); dt.Rows.Add(i,date, "Item." + i ); date = date.AddHours(2); dt.Rows.Add(i,date ,"Item." + i + ".2" ); date = date.AddMonths(i); dt.Rows.Add(i,date, "Item." + i + ".2"); } this.radGridView1.DataSource = dt; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.EnableFiltering = true; this.radGridView1.ShowHeaderCellButtons = true; ((GridViewDateTimeColumn)this.radGridView1.Columns[1]).FilteringMode = GridViewTimeFilteringMode.Date; this.radGridView1.FilterPopupRequired += radGridView1_FilterPopupRequired; } private void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e) { if (e.Column.Name == "Date") { e.FilterPopup = new RadListFilterPopup(e.Column, true); } } Workaround: RadListFilterPopup popup; private void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e) { if (e.Column.Name == "Date") { if (popup == null) { popup = new RadListFilterPopup(e.Column, true); } e.FilterPopup = popup; } }
To reproduce: radGridView1.EnableSorting = true; radGridView1.AutoSizeRows = true; radGridView1.ShowGroupPanel = false; radGridView1.EnableGrouping = false; radGridView1.MasterTemplate.AllowColumnChooser = false; radGridView1.MasterTemplate.AllowAddNewRow = false; radGridView1.MasterTemplate.AllowDeleteRow = false; radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.MasterTemplate.AllowCellContextMenu = false; radGridView1.MasterTemplate.AllowColumnHeaderContextMenu = false; radGridView1.Columns.Add(new GridViewTextBoxColumn("key")); radGridView1.Columns.Add(new GridViewTextBoxColumn("value")); radGridView1.Columns.Add(new GridViewCheckBoxColumn { EnableHeaderCheckBox = true, }); var list = new List<KeyValuePair<string, string>>(); list.Add(new KeyValuePair<string, string>("1", "One")); list.Add(new KeyValuePair<string, string>("2", "Two")); radGridView1.DataSource = list; radGridView1.CurrentRow = null;
To reproduce: - Populate the grid with some double values. - Change the culture to Dutch(Belgian) - Export the grid Workaround: void spreadExporter_CellFormatting(object sender, Telerik.WinControls.UI.Export.SpreadExport.CellFormattingEventArgs e) { if (e.GridColumnIndex == 0 && e.GridCellInfo.Value != string.Empty) { CellValueFormat cvf = new CellValueFormat("0,00"); e.CellSelection.SetFormat(cvf); e.CellSelection.SetValue(((double)e.GridCellInfo.Value)); } }
One should be able to replace the exported file if such exists.
How to reproduce: just create a grid with a great number of rows e.g. 15000 and scroll down using the page down key Workaround: public partial class Form1 : Form { public Form1() { InitializeComponent(); BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new CustomGridDataRowBehavior()); DataTable dataTable = new DataTable(); dataTable.Columns.Add("Id", typeof(int)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("IsValid", typeof(bool)); for (int i = 0; i < 14000; i++) { dataTable.Rows.Add(i, "Name " + i, i % 2 == 0 ? true : false); } this.radGridView1.DataSource = dataTable; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; } } public class CustomGridDataRowBehavior : GridDataRowBehavior { protected override bool ProcessPageUpKey(KeyEventArgs keys) { GridTableElement tableElement = (GridTableElement)this.GridViewElement.CurrentView; int index = this.GridViewElement.CurrentRow.Index - tableElement.RowsPerPage + 1; if (index < 0) { index = 0; } GridViewRowInfo firstScrollableRow = this.GridControl.Rows[index]; this.GridViewElement.CurrentRow = firstScrollableRow; return true; } protected override bool ProcessPageDownKey(KeyEventArgs keys) { GridTableElement tableElement = (GridTableElement)this.GridViewElement.CurrentView; int index = this.GridViewElement.CurrentRow.Index + tableElement.RowsPerPage - 1; if (index > this.GridControl.Rows.Count - 1) { index = this.GridControl.Rows.Count - 1; } GridViewRowInfo lastScrollableRow = this.GridControl.Rows[index]; this.GridViewElement.CurrentRow = lastScrollableRow; return true; } }
To reproduce: - Add a column to the grid and try to set its IsPinned property to true.
To reproduce: public Form1() { InitializeComponent(); GridViewDecimalColumn idColumn = new GridViewDecimalColumn("ID"); radGridView1.MasterTemplate.Columns.Add(idColumn); GridViewDecimalColumn parentIdColumn = new GridViewDecimalColumn("ParentID"); radGridView1.MasterTemplate.Columns.Add(parentIdColumn); GridViewTextBoxColumn nameColumn = new GridViewTextBoxColumn("Name"); radGridView1.MasterTemplate.Columns.Add(nameColumn); GridViewTextBoxColumn addressColumn = new GridViewTextBoxColumn("Address"); radGridView1.MasterTemplate.Columns.Add(addressColumn); GridViewTextBoxColumn typeColumn = new GridViewTextBoxColumn("Type"); radGridView1.MasterTemplate.Columns.Add(typeColumn); radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "ID", "ParentID"); AddNewRow("1", null, "Project", "USA", "Project"); AddNewRow("2", "1", "Site 1", "New York", "Site"); AddNewRow("3", "2", "Bldg 1", "Road 1", "Building"); AddNewRow("4", "1", "Site 2", "New York", "Site"); AddNewRow("5", "4", "Bldg 2", "Road 2", "Building"); AddNewRow("20", "3", "Floor 1", "Road 20", "Floor"); AddNewRow("30", "3", "Floor 2", "Road 30", "Floor"); AddNewRow("40", "3", "Floor 3", "Road 40", "Floor"); } public void AddNewRow( params object[] values) { if (values.Length != radGridView1.Columns.Count) return; GridViewRowInfo newRow = radGridView1.Rows.AddNew(); newRow.Cells[0].Value = values[0]; newRow.Cells[1].Value = values[1]; newRow.Cells[2].Value = values[2]; newRow.Cells[3].Value = values[3]; newRow.Cells[4].Value = values[4]; } When you run the project you will notice that the last row is missing (AddNewRow("40", "3", "Floor 3", "Road 40", "Floor");). Please refer to the attached screenshots. Workaround: use the Rows.Add(params) method instead:
To reproduce: List<Coordinate> coordinates_ = new List<Coordinate>(); public Form1() { InitializeComponent(); for (int i = 0; i < 10; i++) { coordinates_.Add(new Coordinate(i * 0.25, i * 0.33, i * 0.46)); } this.radGridView1.AutoGenerateColumns = false; string mask = "F2"; this.radGridView1.Columns.Add(CreateDecimalColumn("X", "X", mask)); this.radGridView1.Columns.Add(CreateDecimalColumn("Y", "Y", mask)); this.radGridView1.Columns.Add(CreateDecimalColumn("Z", "Z", mask)); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; SetRows(); } GridViewDataColumn CreateDecimalColumn(string name, string headertext, string mask) { var format = "{0:" + mask + "}"; return new GridViewMaskBoxColumn() { Name = name, HeaderText = headertext, MinWidth = 50, MaskType = MaskType.Numeric, Mask = mask, FormatString = format, DataType = typeof(double), TextAlignment = ContentAlignment.MiddleRight }; } void SetRows() { foreach (var c in coordinates_) { var ri = radGridView1.Rows.AddNew(); ri.Cells["X"].Value = c.X; ri.Cells["Y"].Value = c.Y; ri.Cells["Z"].Value = c.Z; } } public class Coordinate { public double X { get; set; } public double Y { get; set; } public double Z { get; set; } public Coordinate(double x, double y, double z) { this.X = x; this.Y = y; this.Z = z; } } Workaround: private void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e) { if (e.EditorType==typeof(RadMaskedEditBoxEditor)) { e.Editor = new RadMaskedEditBoxEditor(); } }