To reproduce: - Add RadGridView to a blank project and bind it to a blank binding source. - Add GridViewMultiComboBoxColumn to the grid and bind it to another binding source. - In the CellEditorInitialized set the autocomplete mode to Suggest. - When you start the application you will notice that the first items is selected but not displayed and to display it you should select other value first and you will be able to select the first one. Workaround: Set the selected item of the editor to null in the CellEditorInitialized event.
Add the ability to filter by empty values (not null values) just like in excel.
To reproduce: - Add some rows to a grid view and set the ClipboardCopyMode to EnableAlwaysIncludeHeaderText. - Copy entire row and paste it in excel. You will notice that the columns are pasted right, but the cells values are merged. - Also when multiple rows are copied the issue does not occur.
The RadGridView designer allows you to add columns and make changes while debugging the application. When you click the Ok button it tells you that your changes cannot be applied and everything is lost. I've done this several times by accident and didn't realize I was debugging until my changes were lost. Maybe disallow making changes to the columns while debugging?
The binding source filtering should be synchronized with the grid one in case other controls are using the same binding source.
To reproduce: - Set the AutoSizeRows and PrintGrouping properties to true. - Add a group descriptor and then call the PrintPreview method of the grid. Workaround: - Use the following classes to create custom print style: public class MyGridPrintRenderer : TableViewDefinitionPrintRenderer { private RadGridView gridView; public MyGridPrintRenderer(RadGridView grid) : base(grid) { gridView = grid; } protected override int GetDataRowHeight(GridViewRowInfo row, TableViewRowLayoutBase rowLayout) { IVirtualizedElementProvider<GridViewRowInfo> rowElementProvider = this.gridView.TableElement.RowScroller.ElementProvider; GridRowElement visualRow = rowElementProvider.GetElement(row, null) as GridRowElement; if (visualRow is GridGroupHeaderRowElement) { return rowLayout.GetRowHeight(row); } return base.GetDataRowHeight(row, rowLayout); } } public class MyGridPrintSyle : GridPrintStyle { protected override BaseGridPrintRenderer InitializePrintRenderer(RadGridView grid) { if (this.PrintRenderer != null) { this.PrintRenderer.PrintCellPaint -= renderer_PrintCellPaint; this.PrintRenderer.PrintCellFormatting -= renderer_PrintCellFormatting; } MyGridPrintRenderer renderer = new MyGridPrintRenderer(grid); renderer.PrintCellFormatting += renderer_PrintCellFormatting; renderer.PrintCellPaint += renderer_PrintCellPaint; return renderer; } private void renderer_PrintCellPaint(object sender, PrintCellPaintEventArgs e) { this.OnPrintCellPaint(sender, e); } private void renderer_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e) { this.OnPrintCellFormatting(sender, e); } }
To reproduce: Add a RadGridView and three GridViewComboBoxColumns with repetitive values: for (int i = 0; i < 3; i++) { List<int> datasource = new List<int>(); for (int j = 0; j < 12; j++) { datasource.Add(j); } this.Grid.Columns.Add(new GridViewComboBoxColumn() { DataSource = datasource }); } for (int i = 0; i < 10; i++) { for (int j = 0; j < 5; j++) { this.Grid.Rows.Add(i, i, i); } } Start the project and sort second and last column by the same value and make sure that you have vertical scrollbar. Select a cell in the second column change its value and press the tab key(or click on another cell in the same row). You will see that the scrollbar will go to the bottom of the grid. Workaround: Use the following class: public class ActionExecuteHelper { #region Singleton private static ActionExecuteHelper instance; private static readonly object syncRoot = new object(); public static ActionExecuteHelper Instance { get { if (instance == null) { lock (syncRoot) { if (instance == null) { instance = new ActionExecuteHelper(); } } } return instance; } } #endregion private readonly Timer timer; public ActionExecuteHelper() { this.timer = new Timer(); } public void ExecuteDelayedAction(Action action, int delayInMilliseconds) { EventHandler timerTick = null; timerTick = delegate { this.timer.Stop(); this.timer.Tick -= timerTick; action.Invoke(); }; this.timer.Tick += timerTick; this.timer.Interval = delayInMilliseconds; this.timer.Start(); } } And use it with the following code private int savedValue; private void Grid_CellEndEdit(object sender, GridViewCellEventArgs e) { this.Grid.TableElement.VScrollBar.ValueChanged += ValueChangedDelegate; } private void ValueChangedDelegate(object sender, EventArgs e) { this.Grid.TableElement.VScrollBar.ValueChanged -= ValueChangedDelegate; ActionExecuteHelper.Instance.ExecuteDelayedAction(new Action(this.SetScrollbarValue), 5); } private void SetScrollbarValue() { this.Grid.TableElement.VScrollBar.Value = savedValue; } private void Grid_ValueChanging(object sender, ValueChangingEventArgs e) { this.savedValue = this.Grid.TableElement.VScrollBar.Value; } This way the value of the scrollbar will be saved and restored.
Description: When you pin data rows from the child template to PinnedRowPosition.Top, it does not affect the row. However, when you pin the certain row to PinnedRowPosition.Bottom, the behavior is correct. The same issue is detected for the header rows from the child template.
Workaround: use the CellValidating event
To reproduce: Sub New() InitializeComponent() Dim dt As New DataTable() For index = 1 To 13 If index = 4 Then dt.Columns.Add("Col" & index, Type.GetType("System.Int32")) Else dt.Columns.Add("Col" & index) End If Next Dim rand As New Random For index = 1 To 9000 Dim newRow As DataRow = dt.NewRow() For Each col As DataColumn In dt.Columns If col.ColumnName = "Col4" Then newRow(col.ColumnName) = rand.Next(2, 1000).ToString() Else newRow(col.ColumnName) = "Data" & index.ToString() & "." & dt.Columns.IndexOf(col).ToString() End If Next dt.Rows.Add(newRow) Next Me.RadGridView1.DataSource = dt Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill Me.RadGridView1.Columns.RemoveAt(3) Dim list As New List(Of CustomerMaster) For index = 1 To 1000 list.Add(New CustomerMaster((index + 1), "Name" & (1000 - index + 1).ToString())) Next Dim CustomerMaster_IDColumn As GridViewComboBoxColumn = New GridViewComboBoxColumn With CustomerMaster_IDColumn .Name = "CustomerMaster_ID" .HeaderText = "Customer Master" .DataSource = list .ValueMember = "Id" .DisplayMember = "Name" .FieldName = "Col4" .Width = 200 .DisplayMemberSort = True .DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList End With Me.RadGridView1.Columns.Insert(3, CustomerMaster_IDColumn) End Sub Public Class CustomerMaster Private _id As String Private _name As String Public Sub New(id As String, name As String) Me._id = id Me._name = name End Sub Public Property Id() As String Get Return _id End Get Set(ByVal value As String) _id = value End Set End Property Public Property Name() As String Get Return _name End Get Set(ByVal value As String) _name = value End Set End Property End Class
To reproduce: Add a RadGridView. Create a DataTable with 3 columns with data type - Decimal. To the last column set the following expression - "column1 + column2". Add some rows with some values. Turn on excel like filtering - http://www.telerik.com/help/winforms/gridview-filtering-excel-like-filtering.html. Subscribe to the CellValueChanged event and add the following code: if (this.radGridView1.CurrentRow.DataBoundItem != null) { ((DataRowView)this.radGridView1.CurrentRow.DataBoundItem).Row.EndEdit(); // force row subtotal update } Start the application and filter the last column by some of the available values. Change a value in one of the first two cells. You will notice that the last cell's value is not updated although it is updated in the data table. This behavior does not occur when the grid is not filtered.
To reproduce: use the code from our demo application for Custom Filtering. Instead of Customers table, bind the grid to Orders or another table with 1000+ rows. Resolution: You can surround the row operation in Begin/EndUpdate(false) and remove the InvalidateRow method. The Custom Filtering example in our demo Application is updated for better performance or you can use the following code snippet: For example: private void radGridView1_CustomFiltering(object sender, Telerik.WinControls.UI.GridViewCustomFilteringEventArgs e) { if (string.IsNullOrEmpty(this.radTextBox1.Text)) { this.radGridView1.BeginUpdate(); e.Visible = true; for (int i = 0; i < this.radGridView1.ColumnCount; i++) { e.Row.Cells[i].Style.Reset(); } //e.Row.InvalidateRow(); this.radGridView1.EndUpdate(false); return; } this.radGridView1.BeginUpdate(); e.Visible = false; for (int i = 0; i < this.radGridView1.ColumnCount; i++) { string text = e.Row.Cells[i].Value.ToString(); if (text.IndexOf(this.radTextBox1.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0) { e.Visible = true; e.Row.Cells[i].Style.CustomizeFill = true; e.Row.Cells[i].Style.DrawFill = true; e.Row.Cells[i].Style.BackColor = Color.FromArgb(201, 252, 254); } else { e.Row.Cells[i].Style.Reset(); } } //e.Row.InvalidateRow(); this.radGridView1.EndUpdate(false); }
To reproduce: - Add GridViewComboBoxColumn to a grid. - Set the DisplayMemeber property like this: column1.DisplayMember = "AddInfo.Status";
To reproduce: Add a RadGridView to a form, dont dock it. Use the following code to add the rows, columns and the definition: this.Grid.Columns.Add("Old"); this.Grid.Columns.Add("New"); Start the application and you will see that you cannot scroll to the end, horizontally. Workaround: Use the following code on a button click or execute it in a timer a few millisecond after the form has loaded in order to update the scrollbar's maximum value accordingly: int width = 0; foreach (var col in this.Grid.Columns) { width += col.Width; } this.Grid.TableElement.HScrollBar.Maximum = width - this.Grid.TableElement.HScrollBar.SmallChange - this.Grid.TableElement.RowHeaderColumnWidth;
Steps to reproduce: 1. expand a parent row 2. remove the first child row (e.g. 'Jon Smith') by selecting the child row and press the button at the top 3. remove the second (last) child row (in this case 'Pete van Dijk') the same way Here is the code snippet: public partial class Form1 : Form { private List<Department> _departments; public Form1() { InitializeComponent(); SetGridParentColumns(); SetGridChildTemplate(); InitData(); grid.RowSourceNeeded += grid_RowSourceNeeded; } private void InitData() { _departments = new List<Department>(2); Department dep1 = new Department() { DepartmentId = 1, Name = "Accounting" }; Department dep2 = new Department() { DepartmentId = 2, Name = "Finance" }; Employee emp1 = new Employee() { DepartmentId = 1, EmployeeId = 1, FirsName = "John", LastName = "Smith" }; Employee emp2 = new Employee() { DepartmentId = 1, EmployeeId = 2, FirsName = "Pete", LastName = "van Dijk" }; Employee emp3 = new Employee() { DepartmentId = 2, EmployeeId = 3, FirsName = "Mark", LastName = "Smith" }; Employee emp4 = new Employee() { DepartmentId = 2, EmployeeId = 4, FirsName = "Jan", LastName = "Janssen" }; dep1.Employees = new List<Employee>() { emp1, emp2 }; dep2.Employees = new List<Employee>() { emp3, emp4 }; _departments.Add(dep1); _departments.Add(dep2); grid.DataSource = _departments; grid.AllowAddNewRow = false; grid.BestFitColumns(); } private void SetGridParentColumns() { grid.AutoGenerateColumns = false; grid.Columns.Add("DepartmentId", "DepartmentId", "DepartmentId"); grid.Columns.Add("Name", "Name", "Name"); } private void SetGridChildTemplate() { grid.Templates.Clear(); GridViewTemplate childTemplate = new GridViewTemplate(); childTemplate.Columns.Add("EmployeeId"); childTemplate.Columns.Add("DepartmentId"); childTemplate.Columns.Add("FirstName"); childTemplate.Columns.Add("LastName"); grid.Templates.Add(childTemplate); childTemplate.HierarchyDataProvider = new GridViewEventDataProvider(childTemplate); } private void grid_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e) { Department dep = e.ParentRow.DataBoundItem as Department; foreach (Employee employee in dep.Employees) { GridViewRowInfo gridRow = e.Template.Rows.NewRow(); gridRow.Cells["EmployeeId"].Value = employee.EmployeeId; gridRow.Cells["DepartmentId"].Value = employee.DepartmentId; gridRow.Cells["FirstName"].Value = employee.FirsName; gridRow.Cells["LastName"].Value = employee.LastName; e.SourceCollection.Add(gridRow); } e.Template.AllowAddNewRow = false; e.Template.BestFitColumns(); } private void btnRemoveChildRow_Click(object sender, EventArgs e) { GridViewRowInfo row = grid.SelectedRows[0]; if (row.ViewTemplate.Parent == null) return; //department (parent) row, so don't remove it int employeeId = Convert.ToInt32(row.Cells["EmployeeId"].Value); int departmentId = Convert.ToInt32(row.Cells["DepartmentId"].Value); Department dep = GetDepartment(departmentId); dep.RemoveEmployee(employeeId); row.ViewTemplate.Refresh(); } private Department GetDepartment(int departmentId) { foreach (Department dep in _departments) if (dep.DepartmentId == departmentId) return dep; return null; } } public class Department { public int DepartmentId { get; set; } public string Name { get; set; } public List<Employee> Employees { get; set; } public void RemoveEmployee(int employeeId) { Employee empToRemove = null; foreach (Employee emp in Employees) { if (emp.EmployeeId == employeeId) { empToRemove = emp; break; } } if (empToRemove != null) Employees.Remove(empToRemove); } } public class Employee { public int DepartmentId { get; set; } public int EmployeeId { get; set; } public string FirsName { get; set; } public string LastName { get; set; } } Workaround: use the ViewInfo.Refresh method instead of the ViewTemplate.Refresh method
1.Different naming of RadGridView templates (in the Smart tag - Relations section and in the Property Builder - Relations section) is confusing. 2.Column reordering via drag and drop in the same template. This action will change the object order of the grid. All changes are shown in the Preview section: I can select columns listed in the object tree, but cannot drag them up or down within a template. The only way I can reorder columns in the property builder appears to be by dragging them left or right in the preview pane. 3.Column moving via drag and drop from one template to another template. This action will change the object order of the grid. All changes are shown in the Preview section: I cannot move columns in the object tree from one template to another. 4.Template reordering via drag and drop. All changes are shown in the Preview section: drag and drop operation for templates in not allowed. 5.There is a right-click context menu for the object tree, with the following options: "Edit", "Expand / Collapse", "New", "Delete". Under no circumstances do the options "Edit" and "New" ever become enabled. 6.The preview pane displays a preview of the columns for the master template. When the child template is selected, the preview pane still shows a preview of the columns for the master template. As such, it is not possible to reorder columns for child templates in the preview pane. 7.When you set up the RadGridView hierarchy automatically at design time and open the Property Builder, all templates are visualized. It is possible to select/deselect columns from the different templates. It is possible to change columns names. However, when you press the OK button and close the Property Builder, try to reopen it. As a result you will notice that all columns from all child templates are selected and all columns contain the default names, no matter what changes were performed. Refer to the corresponding help article http://www.telerik.com/help/winforms/gridview-design-time-support-property-builder.html
To reproduce: -add hierarchical RadGriddView with one parent template and several child templates; -set TableElement.PageViewMode to PageViewMode.ExplorerBar; Selection for different templates is not performed correcltly. Workaround: use custom GridDataRowBehavior: BaseGridBehavior gridBehavior = this.radGridView1.GridBehavior as BaseGridBehavior; gridBehavior.UnregisterBehavior(typeof(GridViewDataRowInfo)); gridBehavior.RegisterBehavior(typeof(GridViewDataRowInfo), new RowSelectionGridBehavior()); public class RowSelectionGridBehavior : GridDataRowBehavior { protected override bool OnMouseDownLeft(MouseEventArgs e) { GridDataRowElement row = this.GetRowAtPoint(e.Location) as GridDataRowElement; if (row != null) { row.RowInfo.IsSelected = true; row.RowInfo.IsCurrent = true; return true; } return base.OnMouseDownLeft(e); } }
To reproduce: -add a RadGridView and use the following code: public Form1() { InitializeComponent(); GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn("ComboBox column"); comboColumn.DataSource = new List<string>() { "first", "second", "third" }; radGridView1.Columns.Add(comboColumn); radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized; } private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e) { RadDropDownListEditor dropDownEditor = radGridView1.ActiveEditor as RadDropDownListEditor; RadDropDownListEditorElement dropDownEditorElement = dropDownEditor.EditorElement as RadDropDownListEditorElement; dropDownEditorElement.SelectedIndex = 0; } If you try to add a new row in the grid, the first item in the RadDropDownListEditor is selected. If you do not make any selection changes and press Enter key, the new row will not be added. Workaround: use the DefaultValuesNeeded event for initializing RadDropDownListEditorElement's selectin
To reproduce: 1. Add RadGridView with 2 columns 2. Sort first column. Then sort second column. 3. Break in the SortChanged event handler method 4. e.NewItems[0].PropertyName is 'column1' and e.OldItems[0].PropertyName is 'column2', the values are swapped