To reproduce: run the attached sample project. Workaround: set the AutoSizeRows property to false before exporting and set it back to true after the export is completed.
To reproduce: follow the steps illustrated in the attached gif file.
One should be able to set the maximum row height when the rows are auto sized and the visual styles are exported.
To reproduce: setup the hierarchy at design time: http://docs.telerik.com/devtools/winforms/gridview/hierarchical-grid/tutorial-binding-to-hierarchical-data Please refer to the attached gif file illustrating the exact steps. NOTE: when the "Object does not match target type" error message is displayed, some of the properties are missing, e.g. MaxLength. Workaround: modify the columns' properties at run time.
Please refer to the attached project. Workakround: call the BeginEdit method in the RadGridView.Click event.
To reproduce: make sure only the first row is selected then Shift select row 3. DataTable dt = new DataTable(); dt.Columns.Add("Value", typeof(int)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Description", typeof(string)); for (int index = 0; index < 15; index++) { dt.Rows.Add(new object[] { index % 5, DateTime.Now.AddSeconds(10), "Index = " + index }); } radGridView1.DataSource = dt; radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.MultiSelect = true; foreach (GridViewColumn col in this.radGridView1.Columns) { ConditionalFormattingObject obj = new ConditionalFormattingObject("Value", ConditionTypes.Equal, col.Index.ToString(), "", true); obj.RowBackColor = Color.SkyBlue; obj.RowForeColor = Color.Red; obj.TextAlignment = ContentAlignment.MiddleRight; obj.ApplyOnSelectedRows = false; this.radGridView1.Columns[0].ConditionalFormattingObjectList.Add(obj); } Workaround: use the CellFormatting event to apply the desired formatting by using the API for overriding theme settings: http://docs.telerik.com/devtools/winforms/gridview/cells/formatting-cells http://docs.telerik.com/devtools/winforms/telerik-presentation-framework/override-theme-settings-at-run-time
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.radGridView1.EnableFiltering = true; this.radGridView1.ShowHeaderCellButtons = true; this.radGridView1.ShowFilteringRow = false; this.radGridView1.Columns["UnitPrice"].FormatString = "{0:$#,###0.00;-$#,###0.00;$0.00}"; } Workaround: in order to format the cells, use the CellFormatting event. As to the filter popup, use the following approach: this.radGridView1.FilterPopupInitialized += radGridView1_FilterPopupInitialized; private void radGridView1_FilterPopupInitialized(object sender, Telerik.WinControls.UI.FilterPopupInitializedEventArgs e) { RadListFilterPopup popup = e.FilterPopup as RadListFilterPopup; if (popup != null) { popup.MenuTreeElement.TreeView.NodeFormatting -= TreeView_NodeFormatting; popup.MenuTreeElement.TreeView.NodeFormatting += TreeView_NodeFormatting; } } private void TreeView_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { decimal price; if (decimal.TryParse(e.Node.Text, out price)) { e.NodeElement.ContentElement.Text = string.Format("{0:$#,###0.00;-$#,###0.00;$0.00}", price); } }
To reproduce: private void radButton1_Click(object sender, EventArgs e) { radGridView1.Rows[0].Cells[0].Value = false; } private void Form1_Load(object sender, EventArgs e) { radGridView1.AllowSearchRow = true; radGridView1.TableElement.SearchHighlightColor = Color.Orange; radGridView1.AutoExpandGroups = true; DataTable dt = new DataTable(); dt.Columns.Add("test", typeof(bool)); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); dt.Rows.Add(true); radGridView1.DataSource = dt; ((Telerik.WinControls.UI.GridViewCheckBoxColumn) radGridView1.Columns[0]).EnableHeaderCheckBox = true; ((Telerik.WinControls.UI.GridViewCheckBoxColumn) radGridView1.Columns[0]).Width = radGridView1.Width - 50; radGridView1.TableElement.Update(Telerik.WinControls.UI.GridUINotifyAction.Reset); //force header checkbox to check radGridView1.TableElement.ScrollTo(15, 0); } Workaround: private void radButton1_Click(object sender, EventArgs e) { radGridView1.Rows[0].Cells[0].Value = false; radGridView1.TableElement.Update(Telerik.WinControls.UI.GridUINotifyAction.Reset); //force header checkbox to check }
To reproduce : public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); radGridView1.DataSource = GetTable(); } private void radButton1_Click(object sender, EventArgs e) { var exporter = new GridViewPdfExport(radGridView1); exporter.FileExtension = "pdf"; exporter.ShowHeaderAndFooter = true; exporter.LeftFooter = GridViewPdfExport.DatePrintedString; exporter.FitToPageWidth = true; exporter.PageMargins = new Padding(20, 15, 10, 10); exporter.RunExport(@"C:\Users\dkaramfi\Desktop\test123.pdf", new PdfExportRenderer()); } static DataTable GetTable() { DataTable table = new DataTable(); table.Columns.Add("Dosage", typeof(int)); table.Columns.Add("Drug", typeof(string)); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Name1", typeof(string)); table.Columns.Add("Name2", typeof(string)); table.Columns.Add("Name3", typeof(string)); table.Columns.Add("Name4", typeof(string)); table.Rows.Add(50, "Enebrel", "Sam", "Sam1", "Sam2", "Sam4", "Sam4"); table.Rows.Add(25, "Indocin", "David"); table.Rows.Add(50, "Enebrel", "Sam"); table.Rows.Add(10, "Hydralazine", "Christoff"); table.Rows.Add(21, "Combivent", "Janet"); table.Rows.Add(100, "Dilantin", "Melanie"); return table; } } Workaround: Leave the default margins.
To reproduce: Sub New() InitializeComponent() ThemeResolutionService.ApplicationThemeName = "Breeze" Dim dt As New DataTable dt.Columns.Add("Id", GetType(Integer)) dt.Columns.Add("ParentId", GetType(Integer)) dt.Columns.Add("Name", GetType(String)) For index = 1 To 5 dt.Rows.Add(index, 0, "Parent" & index) Next Dim rand As New Random For index = 6 To 25 dt.Rows.Add(index, rand.Next(1, 6), "Parent" & index) Next Me.RadGridView1.Relations.AddSelfReference(Me.RadGridView1.MasterTemplate, "Id", "ParentId") Me.RadGridView1.DataSource = dt Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill Me.RadGridView1.AutoSizeRows = True End Sub
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); this.radGridView1.DataSource = this.productsBindingSource; GridViewMultiComboBoxColumn col = new GridViewMultiComboBoxColumn(); col.DataSource = this.categoriesBindingSource; col.MinWidth = 200; col.DisplayMember = "CategoryName"; col.ValueMember = "CategoryID"; this.radGridView1.Columns.Add(col); this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.CellValueChanged += radGridView1_CellValueChanged; } private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e) { RadMessageBox.Show("CellValueChanged. Value >> " + e.Value.ToString()); }
To reproduce: Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.ProductsTableAdapter.Fill(Me.NwindDataSet.Products) Me.CategoriesTableAdapter.Fill(Me.NwindDataSet.Categories) RadGridView1.AutoGenerateHierarchy = True RadGridView1.DataSource = Me.NwindDataSet RadGridView1.DataMember = "Categories" Me.RadGridView1.MasterTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill Me.RadGridView1.MasterTemplate.Templates(0).AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill Me.RadGridView1.UseScrollbarsInHierarchy = True End Sub Private Sub RadGridView1_ViewCellFormatting(sender As Object, e As CellFormattingEventArgs) Handles RadGridView1.ViewCellFormatting If e.Row.HierarchyLevel > 0 Then e.CellElement.TableElement.RowHeaderColumnWidth = 100 End If End Sub
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.suppliersTableAdapter.Fill(this.nwindDataSet.Suppliers); this.productsTableAdapter.Fill(this.nwindDataSet.Products); radGridView1.DataSource = nwindDataSet.Suppliers; radGridView1.BestFitColumns(BestFitColumnMode.AllCells); GridViewTemplate template = CreateTemplate(this.productsBindingSource); template.DataSource = nwindDataSet.Products; radGridView1.MasterTemplate.Templates.Add(template); GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate); relation.ChildTemplate = template; relation.RelationName = "SuppliersProducts"; relation.ParentColumnNames.Add("SupplierID"); relation.ChildColumnNames.Add("SupplierID"); radGridView1.Relations.Add(relation); } private GridViewTemplate CreateTemplate(BindingSource source) { GridViewTemplate template = new GridViewTemplate(); template.Caption = "TaskTemplate"; template.AllowAddNewRow = false; template.EnableFiltering = true; FilterDescriptor filter = new FilterDescriptor(); filter.PropertyName = "ReorderLevel"; filter.Operator = FilterOperator.IsNotEqualTo; filter.Value = 25; template.FilterDescriptors.Add(filter); template.ShowFilteringRow = false; template.SortDescriptors.Expression = "ProductName ASC, UnitPrice ASC"; template.DataSource = source; template.BestFitColumns(BestFitColumnMode.AllCells); return template; } Workaround: set the filter after the hierarchy setup: private void Form1_Load(object sender, EventArgs e) { this.suppliersTableAdapter.Fill(this.nwindDataSet.Suppliers); this.productsTableAdapter.Fill(this.nwindDataSet.Products); radGridView1.DataSource = nwindDataSet.Suppliers; radGridView1.BestFitColumns(BestFitColumnMode.AllCells); GridViewTemplate template = CreateTemplate(this.productsBindingSource); template.DataSource = nwindDataSet.Products; radGridView1.MasterTemplate.Templates.Add(template); GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate); relation.ChildTemplate = template; relation.RelationName = "SuppliersProducts"; relation.ParentColumnNames.Add("SupplierID"); relation.ChildColumnNames.Add("SupplierID"); radGridView1.Relations.Add(relation); FilterDescriptor filter = new FilterDescriptor(); filter.PropertyName = "ReorderLevel"; filter.Operator = FilterOperator.IsNotEqualTo; filter.Value = 25; template.FilterDescriptors.Add(filter); } private GridViewTemplate CreateTemplate(BindingSource source) { GridViewTemplate template = new GridViewTemplate(); template.Caption = "TaskTemplate"; template.AllowAddNewRow = false; template.EnableFiltering = true; template.ShowFilteringRow = false; template.SortDescriptors.Expression = "ProductName ASC, UnitPrice ASC"; template.DataSource = source; template.BestFitColumns(BestFitColumnMode.AllCells); return template; }
Please refer to the attached screenshot and sample video. Workaround: public class CustomGrid : RadGridView { public override string ThemeClassName { get { return typeof(RadGridView).FullName; } } protected override void OnKeyPress(KeyPressEventArgs e) { this.BeginEdit(); if (this.GridViewElement.ActiveEditor is RadDropDownListEditor) { string symbol = e.KeyChar.ToString(); RadDropDownListEditor editor = this.GridViewElement.ActiveEditor as RadDropDownListEditor; RadDropDownListEditorElement element = editor.EditorElement as RadDropDownListEditorElement; if ((element.AutoCompleteMode & AutoCompleteMode.Suggest) == AutoCompleteMode.Suggest) { element.EditableElementText += symbol; element.EditableElement.SelectionStart = 1; element.EditableElement.SelectionLength = 0; } } base.OnKeyPress(e); } }
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); radGridView1.AllowSearchRow = true; radGridView1.DataSource = nwindDataSet.Categories; radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.UseScrollbarsInHierarchy = true; GridViewTemplate template = new GridViewTemplate(); template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; template.DataSource = nwindDataSet.Products; radGridView1.MasterTemplate.Templates.Add(template); GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate); relation.ChildTemplate = template; relation.RelationName = "CategoriesProducts"; relation.ParentColumnNames.Add("CategoryID"); relation.ChildColumnNames.Add("CategoryID"); radGridView1.Relations.Add(relation); } Workaround: private void radGridView1_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e) { if (this.radGridView1.CurrentRow != null) { if (this.radGridView1.CurrentRow.HierarchyLevel > 0) { tableElement.ScrollToRow((GridViewHierarchyRowInfo)(this.radGridView1.CurrentRow).Parent); this.radGridView1.TableElement.EnsureRowVisible((GridViewHierarchyRowInfo)(this.radGridView1.CurrentRow).Parent); tableElement.ScrollToRow(this.radGridView1.CurrentRow); tableElement.EnsureRowVisible(this.radGridView1.CurrentRow); } } }
To reproduce: Search a specific text by focusing the search box programmatically and the using the SendKeys method: private void radButton1_Click(object sender, EventArgs e) { GridSearchCellElement searchCell = radGridView1.TableElement.GetCellElement(radGridView1.MasterView.TableSearchRow, null) as GridSearchCellElement; if (searchCell != null) { searchCell.SearchTextBox.Focus(); searchCell.SearchTextBox.Text = string.Empty; SendKeys.Send("t"); SendKeys.Send("e"); SendKeys.Send("s"); SendKeys.Send("t"); } } Workaround: Repeat the search in the SearchProgressChanged event: radGridView1.MasterView.TableSearchRow.SearchProgressChanged += TextationSearchProgressHandler; protected void TextationSearchProgressHandler(object sender, SearchProgressChangedEventArgs e) { if (e.SearchFinished && null != radGridView1.TableElement) { GridSearchCellElement searchCell = radGridView1.TableElement.GetCellElement(radGridView1.MasterView.TableSearchRow, null) as GridSearchCellElement; if (searchCell != null && searchCell.SearchTextBox.TextBoxItem.Text != e.SearchCriteria) { radGridView1.MasterView.TableSearchRow.Search(searchCell.SearchTextBox.TextBoxItem.Text); } } }
To reproduce: public class Item { public int Id { get; set; } public string Name { get; set; } public DateTime Date { get; set; } public Item(int id, string name, DateTime date) { this.Id = id; this.Name = name; this.Date = date; } } public Form1() { InitializeComponent(); List<Item> items = new List<Item>(); for (int i = 0; i < 10; i++) { items.Add(new Item(i,"Item" + i,DateTime.Now.AddHours(i))); } this.radGridView1.DataSource = items; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; } private void Form1_Load(object sender, EventArgs e) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB"); this.radGridView1.Columns["Date"].ExcelExportFormatString = "M/d/yyyy h:mm tt"; this.radGridView1.Columns["Date"].ExcelExportType = DisplayFormatType.Custom; GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1); spreadExporter.ExportVisualSettings = true; SpreadExportRenderer exportRenderer = new SpreadExportRenderer(); string fileName = @"..\..\exportedFile" + DateTime.Now.ToLongTimeString().Replace(":", "_") + ".xlsx"; spreadExporter.RunExport(fileName, exportRenderer); Process.Start(fileName); }
Workaround: use a custom BaseGridBehavior public Form1() { InitializeComponent(); this.radGridView1.GridBehavior = new MyBaseGridBehavior(); } public class MyBaseGridBehavior : BaseGridBehavior { public override bool ProcessKey(KeyEventArgs keys) { if (keys.Control && this.GridControl.CurrentColumn == null) { return false; } return base.ProcessKey(keys); } }
To reproduce: - Add some rows to a grid. - Sort the rows. - Delete a row. - The current row is not the next row. Workaround: Dim t As Test = RadGridView1.CurrentRow.DataBoundItem Dim index As Integer = Me.RadGridView1.ChildRows.IndexOf(Me.RadGridView1.CurrentRow) datasource.Remove(t) Me.RadGridView1.CurrentRow = Me.RadGridView1.ChildRows(index)