Please refer to the attached gif file illustrating how to reproduce the error with the Demo application. Workaround: this.radGridView1.UseScrollbarsInHierarchy = true;
To reproduce: public RadForm1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Id"); dt.Columns.Add("Name"); for (int i = 0; i < 50; i++) { dt.Rows.Add(i, "Data" + i); } this.radGridView1.DataSource = dt; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.AutoSizeRows = false; } private void RadForm1_Load(object sender, EventArgs e) { this.radGridView1.Rows[5].MinHeight = 80; this.radGridView1.Rows[5].MaxHeight = 100; } The Min/MaxHeight is not respected even when resizing the row. Workaround: set the Height property.
To reproduce: - Subscribe to the CellClick event - Click several times in the grid with the right mouse button. - At some point, the CellClick event will be executed. Workaround: - Use the Click event: private void RadGridView1_Click(object sender, EventArgs e) { var args = e as MouseEventArgs; if (args.Button == MouseButtons.Left) { var clickedCell = radGridView1.ElementTree.GetElementAtPoint(args.Location) as GridDataCellElement; if (clickedCell != null) { //add your code here } } }
Use attached project to reproduce. The video shows what steps you need to take. Workaround: Use CellEndEdit instead.
Use the attached project to reproduce. The video shows what steps you need to take.
To reproduce: private void Form2_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); this.radGridView1.AutoGenerateHierarchy = true; this.radGridView1.DataSource = this.nwindDataSet; this.radGridView1.DataMember = "Categories"; this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.MasterTemplate.Templates.First().AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewSummaryItem summaryItem = new GridViewSummaryItem(); summaryItem.Name = "CategoryID"; summaryItem.Aggregate = GridAggregateFunction.Count; GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem(); summaryRowItem.Add(summaryItem); this.radGridView1.SummaryRowsTop.Add(summaryRowItem); GridViewSummaryItem summaryItem2 = new GridViewSummaryItem(); summaryItem2.Name = "UnitPrice"; summaryItem2.Aggregate = GridAggregateFunction.Sum; GridViewSummaryRowItem summaryRowItem2 = new GridViewSummaryRowItem(); summaryRowItem2.Add(summaryItem2); this.radGridView1.MasterTemplate.Templates.First().SummaryRowsTop.Add(summaryRowItem2); } private void SetNumberFormat() { this.radGridView1.Columns["CategoryID"].FormatString = "{0:F4}"; this.radGridView1.SummaryRowsTop[0][0].FormatString = "{0:F4}"; this.radGridView1.MasterTemplate.Templates.First().Columns["UnitPrice"].FormatString = "{0:F4}"; this.radGridView1.MasterTemplate.Templates.First().SummaryRowsTop[0][0].FormatString = "{0:F4}"; } private void radButton1_Click(object sender, EventArgs e) { SetNumberFormat(); } Workaround: Clear and add back the summary rows when a value in the child template is changed. private void radButton1_Click(object sender, EventArgs e) { this.radGridView1.MasterTemplate.Templates.First().SummaryRowsTop.Clear(); GridViewSummaryItem summaryItem2 = new GridViewSummaryItem(); summaryItem2.Name = "UnitPrice"; summaryItem2.Aggregate = GridAggregateFunction.Sum; GridViewSummaryRowItem summaryRowItem2 = new GridViewSummaryRowItem(); summaryRowItem2.Add(summaryItem2); this.radGridView1.MasterTemplate.Templates.First().SummaryRowsTop.Add(summaryRowItem2); SetNumberFormat(); }
To reproduce: - Add one-to-many relations hierarchy 3 or more child templates. - Export the grid using GridViewSpreadExport - The child rows of the last parent row are missing. Workaround: Add an empty parent row at the end of the grid.
To reproduce: Sub New() InitializeComponent() Dim dt As New DataTable() dt.Columns.Add("Price", GetType(System.Double)) dt.Columns.Add("Name", GetType(System.String)) dt.Columns.Add("Nr", GetType(System.Double)) For i As Integer = 0 To 49 dt.Rows.Add(i, "Data" & i, i) Next With Me.RadGridView1 .DataSource = dt .Columns("Price").FormatString = "{0:C2}" .Columns("Nr").FormatString = "{0:N1}" .Columns("Price").ExcelExportType = Export.DisplayFormatType.Currency ' .AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill End With Me.RadGridView1.Columns("Price").ExcelExportType = Export.DisplayFormatType.Currency Me.RadGridView1.Columns("Nr").ExcelExportType = Export.DisplayFormatType.Custom Me.RadGridView1.Columns("Nr").ExcelExportFormatString = "{0:N1}" Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click Dim spreadStreamExport As New GridViewSpreadStreamExport(Me.RadGridView1) spreadStreamExport.ExportVisualSettings = True Dim fileName As String = "..\..\" + DateTime.Now.ToLongTimeString().Replace(":", "_").ToString() + ".xlsx" spreadStreamExport.RunExport(fileName, New SpreadStreamExportRenderer()) Process.Start(fileName) End Sub Workaround: Me.RadGridView1.Columns("Nr").ExcelExportType = Export.DisplayFormatType.Fixed AddHandler spreadStreamExport.CellFormatting, AddressOf CellFormatting Private Sub CellFormatting(sender As Object, e As SpreadStreamCellFormattingEventArgs) If e.ExportCell.ColumnIndex = 2 Then e.ExportCell.ExportFormat = "0.0" End If End Sub
The specified format in the DisplayFormat attribute should be considered when automatically generating the GridViewDateTimeColumn. public RadForm1() { InitializeComponent(); List<Item> items = new List<Item>(); for (int i = 0; i < 5; i++) { items.Add(new Item(DateTime.Now.AddDays(i))); } this.radGridView1.DataSource = items; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; } public class Item { [System.ComponentModel.DisplayName("My Date")] [System.ComponentModel.DataAnnotations.DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")] public DateTime Date { get; set; } public Item(DateTime date) { this.Date = date; } }
To reproduce: please refer to the attached gif file and sample project. The multiple newly added rows are selected only when the grid is not sorted. Workaround: use Begin/EndUpdate when adding multiple rows private void radButton1_Click(object sender, EventArgs e) { this.radGridView1.ClearSelection(); this.radGridView1.BeginUpdate(); for (int i = 0; i < 3; i++) { GridViewDataRowInfo row = new GridViewDataRowInfo(this.radGridView1.MasterView); row.IsSelected = true; row.IsCurrent = true; row.Cells["Id"].Value = this.radGridView1.Rows.Count; row.Cells["Name"].Value = "Row" + row.Cells["Id"].Value; this.radGridView1.Rows.Add(row); } this.radGridView1.EndUpdate(); }
To reproduce: 1. Use the following code: public Form1() { InitializeComponent(); this.radGridView1.EnableFiltering = true; GridViewDecimalColumn col = new GridViewDecimalColumn(); col.Name = "Calculated Column"; col.HeaderText = "Order value"; radGridView1.Columns.Add(col); radGridView1.Columns["Calculated Column"].Expression = "Freight/Sum(Freight)"; } private void Form1_Load(object sender, EventArgs e) { this.ordersTableAdapter.Fill(this.nwindDataSet.Orders); this.radGridView1.DataSource = this.ordersBindingSource; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewSummaryItem summaryItem = new GridViewSummaryItem(); summaryItem.Name = "Freight"; summaryItem.Aggregate = GridAggregateFunction.Sum ; GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem(); summaryRowItem.Add(summaryItem); this.radGridView1.SummaryRowsTop.Add(summaryRowItem); this.radGridView1.SummaryRowsBottom.Add(summaryRowItem); } 2. Filter the grid by EmployeeID for example. You will notice that the summary item for Freight is recalculated considering the filtered rows. However, the calculated column doesn't update its values.
To reproduce: Sub New() InitializeComponent() Dim dt As New DataTable dt.Columns.Add("Id", GetType(Integer)) dt.Columns.Add("Name", GetType(String)) For index = 1 To 200000 dt.Rows.Add(index, "Item" & index) Next Me.RadGridView1.DataSource = dt Me.RadGridView1.MultiSelect = True Me.RadGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click Dim sw As New Stopwatch sw.Start() Dim mi As MethodInfo = GetType(GridViewSelectedCellsCollection).GetMethod("BeginUpdate", BindingFlags.Instance Or BindingFlags.NonPublic) mi.Invoke(Me.RadGridView1.MasterTemplate.SelectedCells, Nothing) For Each row As GridViewDataRowInfo In Me.RadGridView1.Rows row.Cells("Name").IsSelected = True Next Dim mi2 As MethodInfo = GetType(GridViewSelectedCellsCollection).GetMethod("EndUpdate", BindingFlags.Instance Or BindingFlags.NonPublic) mi2.Invoke(Me.RadGridView1.MasterTemplate.SelectedCells, New Object() {True}) sw.Stop() RadMessageBox.Show(sw.ElapsedMilliseconds) End Sub
To reproduce: - Create load on demand hierarchy. - Open the excel filter popup. - The RowSourceNeeded event fires for all rows. Workaround: public class MyGridHeaderCellElement : GridHeaderCellElement { public MyGridHeaderCellElement(GridViewDataColumn col, GridRowElement row) : base(col, row) { } protected override Type ThemeEffectiveType { get { return typeof(GridHeaderCellElement); } } protected override IGridFilterPopup CreateFilterPopup() { this.GridControl.Tag = "FileterInitializing"; return base.CreateFilterPopup(); } } // in the main forms you cab skip the event code execution while the popup is initialized private void RadGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e) { this.radGridView1.Tag = null; } private void RadGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e) { if (object.ReferenceEquals(e.CellType, typeof(GridHeaderCellElement))) { e.CellType = typeof(MyGridHeaderCellElement); } } void radGridView1_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e) { if (radGridView1.Tag != null && radGridView1.Tag == "FileterInitializing") { return; } //other code }
To reproduce: please refer o the attached sample project: 1.Click the left button. A new row will be added to the left grid and the grid will scroll to it. 2. Move the scrollbar back to the top and sort the ID column. 3. Click the left button again. A new row will be added but the grid won't scroll to it. Perform the same steps with the right grid. The grid scrolls as expected when you add a new row in a sorted grid. Workaround: use the Rows.Add method instead of Rows.AddNew.
To reproduce: The attached video shows how you can reproduce this. Workaround: Use the Properties window to remove summary rows.
To reproduce: please refer to the attached sample project and gif file. Workaround: private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e) { RadDateTimeEditor editor = e.ActiveEditor as RadDateTimeEditor; if (editor != null) { RadDateTimeEditorElement el = editor.EditorElement as RadDateTimeEditorElement; if (el != null) { el.TextBoxElement.TextBoxItem.GotFocus -= TextBoxItem_GotFocus; el.TextBoxElement.TextBoxItem.GotFocus += TextBoxItem_GotFocus; } } } private void TextBoxItem_GotFocus(object sender, EventArgs e) { RadTextBoxItem tb = sender as RadTextBoxItem; if (tb != null) { tb.SelectionLength = 0; } }
To reproduce: public RadForm1() { InitializeComponent(); this.radGridView1.MasterTemplate.Columns.Add(new GridViewDecimalColumn("ParentId")); this.radGridView1.MasterTemplate.Columns.Add(new GridViewTextBoxColumn("ParentName")); this.radGridView1.MasterTemplate.Rows.Add(1, "Item" + 1); this.radGridView1.MasterTemplate.Rows.Add(2, "Item" + 2); this.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; for (int i = 0; i < 10; i++) { GridViewTemplate template = new GridViewTemplate(); template.AllowAddNewRow = false; template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; template.Caption = "Tab" + i; template.Columns.Add(new GridViewDecimalColumn("Id")); template.Columns.Add(new GridViewTextBoxColumn("Name")); this.radGridView1.MasterTemplate.Templates.Add(template); template.HierarchyDataProvider = new GridViewEventDataProvider(template); } this.radGridView1.RowSourceNeeded += radGridView1_RowSourceNeeded; } private void radGridView1_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e) { for (int i = 0; i < 10; i++) { GridViewRowInfo row = e.Template.Rows.NewRow(); row.Cells["Id"].Value = e.ParentRow.Cells["ParentId"].Value; row.Cells["name"].Value = "child row" + i; e.SourceCollection.Add(row); } } private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) { GridDetailViewCellElement cell = e.CellElement as GridDetailViewCellElement; if (cell != null) { RadPageViewStripElement strip = cell.PageViewElement as RadPageViewStripElement; strip.StripButtons = StripViewButtons.LeftScroll | StripViewButtons.RightScroll; } } If you have just one row on the master level, the strip buttons don't navigate the tabs. Workaround: add a dummy row that is hidden: private void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e) { if (e.RowElement.RowInfo == this.radGridView1.Rows.Last()) { e.RowElement.RowInfo.Height = 1; e.RowElement.RowInfo.MinHeight = 1; e.RowElement.RowInfo.MaxHeight = 1; } else { e.RowElement.RowInfo.Height = 25; e.RowElement.RowInfo.MinHeight = 25; e.RowElement.RowInfo.MaxHeight = 25; } }
Workaround: custom CompositeFilterForm private void radGridView1_CreateCompositeFilterDialog(object sender, GridViewCreateCompositeFilterDialogEventArgs e) { e.Dialog = new MyCompositeFilterForm(); } public class MyCompositeFilterForm : CompositeFilterForm { public override void Initialize(GridViewDataColumn dataColumn, Telerik.WinControls.Data.FilterDescriptor filterDescriptor, bool useTypedEditors) { base.Initialize(dataColumn, filterDescriptor, useTypedEditors); if (dataColumn.Name == "Time") { RadDateTimePicker rEditor = (RadDateTimePicker)this.RightEditor; rEditor.DateTimePickerElement.ShowTimePicker = true; rEditor.DateTimePickerElement.CalendarSize = new Size(500, 250); RadDateTimePicker lEditor = (RadDateTimePicker)this.LeftEditor; lEditor.DateTimePickerElement.ShowTimePicker = true; lEditor.DateTimePickerElement.CalendarSize = new Size(500, 250); } } protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { base.OnClosing(e); if (this.DialogResult == DialogResult.OK) { object leftValue = this.GetValueFromDateEditor(this.LeftEditor); if (leftValue != null) { this.LeftDescriptor.Value = leftValue; } object rightValue = this.GetValueFromDateEditor(this.RightEditor); if (rightValue != null) { this.RightDescriptor.Value = rightValue; } } } protected virtual object GetValueFromDateEditor(RadControl editorControl) { object value = null; if (editorControl is RadDateTimePicker) { value = ((RadDateTimePicker)editorControl).Value; return value; } return value; } }
The issue can be reproduced with the .40 version of the assemblies and in a scenario in which the grid is added as a RadMenuHostItem to the Items collection of a drop-down button. Workaround: set the BindingContext of the grid to equal that of the form: public Form1() { InitializeComponent(); radGridView1.BindingContext = this.BindingContext; }
To reproduce: public Form1() { InitializeComponent(); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text1")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text2")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text3")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text4")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text5")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text6")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text7")); radGridView1.Columns.Add(new GridViewTextBoxColumn("Text8")); radGridView1.Columns.Add(new GridViewDateTimeColumn("Date1")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount1")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount2")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount3")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount4")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount5")); radGridView1.Columns.Add(new GridViewDecimalColumn("Amount6")); radGridView1.DataSource = GetDataSet(); } private DataTable GetDataSet() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Text1", typeof(string))); dt.Columns.Add(new DataColumn("Text2", typeof(string))); dt.Columns.Add(new DataColumn("Text3", typeof(string))); dt.Columns.Add(new DataColumn("Text4", typeof(string))); dt.Columns.Add(new DataColumn("Text5", typeof(string))); dt.Columns.Add(new DataColumn("Text6", typeof(string))); dt.Columns.Add(new DataColumn("Text7", typeof(string))); dt.Columns.Add(new DataColumn("Text8", typeof(string))); dt.Columns.Add(new DataColumn("Date1", typeof(DateTime))); dt.Columns.Add(new DataColumn("Amount1", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount2", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount3", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount4", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount5", typeof(decimal))); dt.Columns.Add(new DataColumn("Amount6", typeof(decimal))); for (int i = 1; i <= 150000; i++) { dt.Rows.Add(new object[] { "Example Text For Row " + i.ToString(), "Example Text For Row " + i.ToString(), "More Example Text For Row " + i.ToString(), "Even More Example Text For Row " + i.ToString(), "Lots More Example Text For Row " + i.ToString(), "Excessive Example Text For Row " + i.ToString(), "Extra Example Text For Row " + i.ToString(), "Random Example Text For Row " + i.ToString(), new DateTime(2015, i % 12 + 1, i % 28 + 1), i % 2 * 10000, i % 3 * 10000, i % 5 * 10000, i % 7 * 10000, i % 11 * 10000, i % 13 * 10000 }); } return dt; } string fileName = @"..\..\" + DateTime.Now.ToLongTimeString().Replace(":", "_"); private void button1_Click(object sender, EventArgs e) { SaveFileDialog sfdExportToExcel = new SaveFileDialog(); DialogResult exportBrowse = sfdExportToExcel.ShowDialog(); if (exportBrowse == DialogResult.OK) { GridViewSpreadExport exporter = new GridViewSpreadExport(this.radGridView1); exporter.SheetMaxRows = Telerik.WinControls.UI.Export.ExcelMaxRows._1048576; exporter.FileExportMode = FileExportMode.CreateOrOverrideFile; exporter.ExportVisualSettings = false; exporter.AsyncExportCompleted += exporter_AsyncExportCompleted; SpreadExportRenderer renderer = new SpreadExportRenderer(); exporter.RunExportAsync(fileName, renderer); } }