Consider the case where there are many child views and you want to export only the ones that actually contain data. Currently, you can either export only one view or all. One should be able to pass all the views in the ChildViewExporting event.
To reproduce: use the following code snippet and have a look at the attached gif file. Steps: 1.Populate RadGridView with data and enable Excel-like filtering. 2.Click on a column filter icon and type in the Search textbox so more than two results appear. Then, click OK 2.The grid returns correct result. 3. Click on the previous column filter icon and navigate to Available Filters -> Contains 4. Evaluate the initial pop up dialog. You will notice that the 3rd filter descriptor is not displayed in the form. 5. Then, click OK 6. A message that says: "The composite filter descriptor is not valid". 7. Change the latter condition to "No filter" and click OK 8. The grid returns correct result. CompositeFilterForm should be improved on a way to display all applied filters,not only two of them. public Form1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Group", typeof(string)); dt.Columns.Add("Description", typeof(string)); for (int i = 0; i < 20; i++) { dt.Rows.Add(GenerateWord(3), "Description"); } this.radGridView1.DataSource = dt; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.EnableFiltering = true; this.radGridView1.ShowHeaderCellButtons = true; this.radGridView1.ShowFilteringRow = false; this.radGridView1.CreateCompositeFilterDialog += radGridView1_CreateCompositeFilterDialog; } string word = null; int cons; int vow; //counter int i = 0; bool isword = false; Random rand = new Random(); //set a new string array of consonants string[] consonant = new string[] { "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z" }; //set a new string array of vowels string[] vowel = new string[] { "a", "e", "i", "o", "u" }; string GenerateWord(int length) { if (length < 1) // do not allow words of zero length throw new ArgumentException("Length must be greater than 0"); string word = string.Empty; if (rand.Next() % 2 == 0) // randomly choose a vowel or consonant to start the word word += consonant[rand.Next(0, 20)]; else word += vowel[rand.Next(0, 4)]; for (int i = 1; i < length; i += 2) // the counter starts at 1 to account for the initial letter { // and increments by two since we append two characters per pass string c = consonant[rand.Next(0, 20)]; string v = vowel[rand.Next(0, 4)]; if (c == "q") // append qu if the random consonant is a q word += "qu"; else // otherwise just append a random consant and vowel word += c + v; } // the word may be short a letter because of the way the for loop above is constructed if (word.Length < length) // we'll just append a random consonant if that's the case word += consonant[rand.Next(0, 20)]; return word; } Workaround: By using the CreateCompositeFilterDialog event you can replace the default CompositeFilterForm with your custom one where you can load all available filter descriptors.
To reproduce: add a RadGridView and a RadButton on the form. Use the following code snippet: public RadForm1() { InitializeComponent(); this.radGridView1.Columns.Add("Col1"); this.radGridView1.Columns.Add("Col2"); for (int i = 0; i < 5; i++) { this.radGridView1.Rows.Add(i, "Item" + i); } this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; this.radGridView1.RowValidating += radGridView1_RowValidating; this.radGridView1.UserAddingRow += radGridView1_UserAddingRow; } private void radGridView1_UserAddingRow(object sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e) { e.Cancel = true; } private void radGridView1_RowValidating(object sender, Telerik.WinControls.UI.RowValidatingEventArgs e) { if (e.Row.IsModified && e.Row is GridViewDataRowInfo) { e.Cancel = true; } } private void radButton1_Click(object sender, EventArgs e) { RadMessageBox.Show("Clicked"); } 1. Select a data cell and activate the editor. Enter some new value and click the button. The Click event is fired. 2. Select the new row and activate the editor. Enter some value and click the button. The Click event is NOT fired. Workaround: use the CellValidating event instead.
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: 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; } }
To reproduce: please refer to the attached gif file demonstrating how to reproduce the issue with the Demo application. Workaround: use the basic filtering.
Repeat the master template headers right after the end of an expanded detail template. The purpose is clarity for the end user.
To reproduce: public Form1() { InitializeComponent(); this.radGridView1.Columns.Add("Name"); this.radGridView1.Columns.Add("ID"); this.radGridView1.RowsChanged += radGridView1_RowsChanged; } private void radGridView1_RowsChanged(object sender, GridViewCollectionChangedEventArgs e) { Console.WriteLine(e.Action); if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add) { GridViewRowInfo row = e.NewItems[0] as GridViewRowInfo; row.Cells["ID"].Value = this.radGridView1.Rows.Count; } } private void radButton1_Click(object sender, EventArgs e) { this.radGridView1.Rows.Add("Item" + this.radGridView1.Rows.Count); } Note: the first firing of the RowsChanged event used to be with Action=Add.
Create a DataTable with columns Column1, Column2, Column3, Column4, Column5, and bound to RadGridView. Create a second DataTable with columns Column1, Column2a, Column3, Column4, Column5, and re-bind the RadGridView to this DataTable. Instead of the columns appearing in the same order as they are in the second DataTable, they show up as Column1, Column3, Column4, Column5, Column2a in the RadGridView.
To reproduce: Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.CategoriesTableAdapter.Fill(Me.NwindDataSet.Categories) Me.RadGridView1.DataSource = Me.CategoriesBindingSource Dim viewDef As New ColumnGroupsViewDefinition Dim group1 = New GridViewColumnGroup() Dim row1 = New GridViewColumnGroupRow group1.Rows.Add(row1) row1.ColumnNames.Add("CategoryID") row1.ColumnNames.Add("CategoryName") viewDef.ColumnGroups.Add(group1) Dim group2 = New GridViewColumnGroup() Dim row2 = New GridViewColumnGroupRow group2.Rows.Add(row2) row2.ColumnNames.Add("Description") row2.ColumnNames.Add("Picture") viewDef.ColumnGroups.Add(group2) Me.RadGridView1.ViewDefinition = viewDef End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click Console.WriteLine("BEFORE >>") For Each col As GridViewColumn In Me.RadGridView1.Columns Console.WriteLine(col.Name & " >> " & col.Width ) Next Dim style As New GridPrintStyle() style.FitWidthMode = PrintFitWidthMode.FitPageWidth Me.RadGridView1.PrintStyle = style Me.RadGridView1.PrintPreview() Console.WriteLine("AFTER >>") For Each col As GridViewColumn In Me.RadGridView1.Columns Console.WriteLine(col.Name & " >> " & col.Width) Next End Sub IMPORTANT: If you resize one of the columns at run time before calling the PrintPreview method, the columns' width is restored. In addition, if you call the PrintPreview method without resizing the columns before that, close the dialog and hide one of the columns by using the default context menu, the columns' width for the visible columns is enlarged. Workaround: you can get the columns width by using the ColumnGroupRowLayout: Dim rowLayout As ColumnGroupRowLayout = TryCast(Me.RadGridView1.TableElement.ViewElement.RowLayout, ColumnGroupRowLayout) For Each col As GridViewColumn In Me.RadGridView1.Columns Dim info As ColumnGroupsCellArrangeInfo = rowLayout.GetColumnData(col) Debug.WriteLine(col.Name & " >> " & info.Bounds.Width) Next
To reproduce: - Add DateTime column and set the RowHeight to 20. - Set the theme to Windows7. - The text is not visible when the editor is shown. Workaround: private void RadGridView2_CellEditorInitialized(object sender, GridViewCellEventArgs e) { RadDateTimeEditor editor = e.ActiveEditor as RadDateTimeEditor; if (editor != null) { var element = editor.EditorElement as RadDateTimeEditorElement; element.Font = new Font("Segoe UI", 8, FontStyle.Regular); element.Children[1].Visibility = ElementVisibility.Collapsed; element.TextBoxElement.ShowBorder = false; element.TextBoxElement.TextBoxItem.HostedControl.MinimumSize = new Size(0, 12); } }
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); } } }
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); } } }
Workaround: use custom editor element private void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e) { if (e.EditorType == typeof(RadMultiColumnComboBoxElement)) { e.EditorType = typeof(MyRadMultiColumnComboBoxElement); } } public class MyRadMultiColumnComboBoxElement : RadMultiColumnComboBoxElement { protected override Type ThemeEffectiveType { get { return typeof(RadMultiColumnComboBoxElement); } } protected override void ProcessKeyDown(object sender, KeyEventArgs e) { base.ProcessKeyDown(sender, e); FieldInfo fi = this.GetType().BaseType.BaseType.GetField("oldTextValue", BindingFlags.Instance | BindingFlags.NonPublic); fi.SetValue(this, this.textBox.Text.Substring(0, this.textBox.SelectionStart)); } }