Steps to reproduce: 1. Add a CompositeFilterDescriptor programmatically as it is demonstrated in the following help article: http://docs.telerik.com/devtools/winforms/gridview/filtering/setting-filters-programmatically-(composite-descriptors) 2. Save the layout. 3. Load the layout. Workaround: specify the PropertyName property for the CompositeFilterDescriptor.
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); }
Currently, it is only possible to define two filter conditions in the Custom Filter Dialog. It would be better if there is possibility for adding multiple filter conditions, similar to the possibility given by the Conditional Formatting Dialog
How to reproduce: check the attached video as well public partial class Form1 : Form { public Form1() { InitializeComponent(); this.radGridView1.DataSource = this.GetData(); } private DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Bool", typeof(bool)); for (int i = 0; i < 10; i++) { dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0); } return dt; } private void radButton1_Click(object sender, EventArgs e) { this.radGridView1.TableElement.ScrollToRow(0); this.radGridView1.Focus(); } } Workaround: call the method if the row is not selected private void radButton1_Click(object sender, EventArgs e) { if (!this.radGridView1.Rows[0].IsSelected) { this.radGridView1.TableElement.ScrollToRow(0); } this.radGridView1.Focus(); }
AutoSizeRows is not currently supported.
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.productsTableAdapter.Fill(this.nwindDataSet.Products); this.categoriesTableAdapter.Fill(this.nwindDataSet.Categories); this.radGridView1.AutoGenerateColumns = false; this.radGridView1.DataSource = this.productsBindingSource; GridViewComboBoxColumn col = new GridViewComboBoxColumn(); col.DataSource = this.categoriesBindingSource; col.MinWidth = 200; col.DisplayMember = "Description"; 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) { string value = "{nothing}"; if (e.Value != null) { value = Convert.ToString(e.Value); } RadMessageBox.Show("CellValueChanged. Value >> " + value); } Note: if the cell value is not null, the CellValueChanged event is not fired when the selection in drop down is not changed. Additional scenario: if you use a RadMultiColumnComboBoxElement for this column replaced in the EditorRequired, the issue is reproducible again.
Workaround: Inherit the GridViewSearchRowInfo and override the SelectNextSearchResult method class MyGridViewSearchRowInfo : GridViewSearchRowInfo { private GridViewInfo gridViewInfo; private RadGridView radGridView; public MyGridViewSearchRowInfo(GridViewInfo gridViewInfo, RadGridView radGridView) : base(gridViewInfo) { this.radGridView = radGridView; } public override Type RowElementType { get { return typeof(GridSearchRowElement); } } public override void SelectNextSearchResult() { if (this.radGridView != null) { this.radGridView.ElementTree.Control.Invoke(() => { base.SelectNextSearchResult(); }); } } }
The problematic themes are: Aqua HighContrastBlack VisualStudio2012Dark VisualStudio2012Light Windows8 How to reproduce: private void RadForm1_Load(object sender, EventArgs e) { var theme = new Windows8Theme(); ThemeResolutionService.ApplicationThemeName = "Windows8"; GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); textBoxColumn.Name = "Test"; this.radGridView1.Columns.Add(textBoxColumn); for (int i = 0; i < 100; i++) { this.radGridView1.Rows.AddNew(); } } Workaround: private void RadForm1_Load(object sender, EventArgs e) { var theme = new Windows8Theme(); ThemeResolutionService.ApplicationThemeName = "Windows8"; GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); textBoxColumn.Name = "Test"; this.radGridView1.Columns.Add(textBoxColumn); this.radGridView1.BeginUpdate(); for (int i = 0; i < 100; i++) { this.radGridView1.Rows.AddNew(); } this.radGridView1.EndUpdate(); int lastRow = this.radGridView1.Rows.Count - 1; this.radGridView1.Rows[lastRow].IsCurrent = true; }
Use the attached project to reproduce. Workaround: Set the MaxWidth/MinWidth of the column manually.
To reproduce use the attached project. Workaround: Private Sub gvData_UserAddedRow(sender As Object, e As Telerik.WinControls.UI.GridViewRowEventArgs) Handles gvData.UserAddedRow Dim pi = GetType(GridViewNewRowInfo).GetProperty("MoveToLastRow", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic) pi.SetValue(Me.gvData.MasterView.TableAddNewRow, True, Nothing) End Sub
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: - Bind the grid to an object that contains enum property. - Save the layout - Restart the application and load the layout before setting the DataSource of the grid. Workaround: Load the layout after the DataSource is set.
Description: if you filter a text column with "Does not contains" operator, the produced FilterDescriptors.Expression is "ProductName NOT LIKE '%c%' OR ProductName IS NULL". However, if you try to programmatically add this expression to the RadGridView.FilterDescriptors.Expression property it doesn't filter the grid. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.ProductsTableAdapter.Fill(Me.NwindDataSet.Products) Me.RadGridView1.EnableFiltering = True End Sub Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click Me.RadGridView1.FilterDescriptors.Expression = "ProductName NOT LIKE '%c%' OR ProductName IS NULL" End Sub Workaround: don't set expression but add a FilterDescriptor: http://docs.telerik.com/devtools/winforms/gridview/filtering/setting-filters-programmatically-(simple-descriptors) Dim filter1 As New FilterDescriptor() filter1.[Operator] = FilterOperator.NotContains filter1.Value = "c" filter1.IsFilterEditor = True filter1.PropertyName = "ProductName" Me.RadGridView1.FilterDescriptors.Add(filter1)
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); GridViewDecimalColumn decimalColumn = new GridViewDecimalColumn(); decimalColumn.Name = "DecimalColumn"; decimalColumn.HeaderText = "DecimalColumn"; this.radGridView1.MasterTemplate.Columns.Add(decimalColumn); GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn(); textBoxColumn.Name = "TextBoxColumn"; textBoxColumn.HeaderText = "TextBoxColumn"; this.radGridView1.MasterTemplate.Columns.Add(textBoxColumn); GridViewDateTimeColumn dateTimeColumn = new GridViewDateTimeColumn(); dateTimeColumn.Name = "DateTimeColumn"; dateTimeColumn.HeaderText = "DateTimeColumn"; this.radGridView1.MasterTemplate.Columns.Add(dateTimeColumn); } } Workaround: this.radGridView1.MasterView.TableAddNewRow.MinHeight = 30;
Please refer to the attached sample project. Activate the editor for the "Notes" column of the first row, don't perform any changes and click another row. You will notice that the DataRow.RowState is Modified although no change is performed. If you perform the same actions with a MS DataGridView, the RowState is not Modified. Note: the GridViewRowInfo.IsModified property in the CellEndEdit is also set to true without modifying the cell's value. Workaround: handle the CellBeginEdit and CellEndEdit events and compare the values before and after the edit operation: object initialValue = null; private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) { initialValue = e.Row.Cells[e.ColumnIndex].Value; } private void radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e) { if (initialValue != e.Value) { Console.WriteLine("modified"); } else { Console.WriteLine("NOT modified"); } }
Hello, we have a RadGridview with a number column and a activated filter for this Grid. If we want to filter data by the value "123" the input in the filter textBox is shown as "321.00" (right-to-left). This is no problem by columns with text values. And at the line for a new data row the input is correct, too.
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: DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("IsActive", typeof(bool)); dt.Rows.Add(1, "Parent1", false); dt.Rows.Add(2, "Parent2", false); this.radGridView1.DataSource = dt; ((GridViewCheckBoxColumn)this.radGridView1.MasterTemplate.Columns["IsActive"]).EnableHeaderCheckBox = true; this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; DataTable childDataTable = new DataTable(); childDataTable.Columns.Add("Id", typeof(int)); childDataTable.Columns.Add("Title", typeof(string)); childDataTable.Columns.Add("ParentId", typeof(int)); childDataTable.Columns.Add("IsValid", typeof(bool)); childDataTable.Rows.Add(1, "Child 1", 1, false); childDataTable.Rows.Add(2, "Child 1", 1, false); childDataTable.Rows.Add(3, "Child 2", 2, false); childDataTable.Rows.Add(4, "Child 2", 2, false); GridViewTemplate template = new GridViewTemplate(); template.DataSource = childDataTable; ((GridViewCheckBoxColumn)template.Columns["IsValid"]).EnableHeaderCheckBox = true; radGridView1.MasterTemplate.Templates.Add(template); template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; GridViewRelation relation = new GridViewRelation(radGridView1.MasterTemplate); relation.ChildTemplate = template; relation.RelationName = "MasterDeatial"; relation.ParentColumnNames.Add("Id"); relation.ChildColumnNames.Add("ParentId"); radGridView1.Relations.Add(relation);
To reproduce: populate the grid with data and use the following code snippet: Me.RadGridView1.EnableAlternatingRowColor = True Me.RadGridView1.TableElement.AlternatingRowColor = Color.LightGray Me.RadGridView1.MultiSelect = True Me.RadGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect Select multiple cells from different rows. You will notice that alternating color is not applied to the rows for which you have a selected cell. The attached gif file illustrates the behavior. Workaround: Sub New() InitializeComponent() Me.RadGridView1.MultiSelect = True Me.RadGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect End Sub Private Sub RadGridView1_CellFormatting(sender As Object, e As Telerik.WinControls.UI.CellFormattingEventArgs) _ Handles RadGridView1.CellFormatting e.CellElement.DrawFill = True e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid If e.CellElement.IsSelected Then e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local) ElseIf e.CellElement.RowInfo.Index Mod 2 = 0 Then e.CellElement.BackColor = Color.White Else e.CellElement.BackColor = Color.LightGray End If End Sub
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.