Completed
Last Updated: 01 Jun 2022 11:44 by ADMIN
Release R2 2022 SP1

Hi

I just found a strange issue using the latest bits of the Telerik RadGridView. 

I have a grid that contains ColumnGroupsViewDefinition. Inside one of the group, one of the column is a GridViewComboBoxColumn.

The grid shows correctly on the screen.

If I try to export it using GridViewSpreadExport, I get an exception saying "input string was not in a correct format".

The export works fine if:

-I don't have groups

-I export to HTML using ExportToHTML

-I export to HTML using ExportToCSV

 

Any help please?

Completed
Last Updated: 05 Oct 2016 14:00 by ADMIN
Workaround: 

 public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            this.radGridView1.DataSource = this.GetData();
            this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

            ((GridViewDateTimeColumn)this.radGridView1.Columns["Date"]).FormatString = "{0: yyyy-MM-dd hh:mm:ss.fff tt}";
        }

        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 < 100; i++)
            {
                dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0);
            }

            return dt;
        }
    }

 public class MyRadGridView : RadGridView
    {
        public override string ThemeClassName
        {
            get
            {
                return typeof(RadGridView).FullName;
            }
        }

        protected override RadGridViewElement CreateGridViewElement()
        {
            return new MyRadGridViewElement();
        }
    }

 public class MyRadGridViewElement : RadGridViewElement
    {
        protected override Type ThemeEffectiveType
        {
            get
            {
                return typeof(MyRadGridViewElement);
            }
        }

        protected override MasterGridViewTemplate CreateTemplate()
        {
            return new MyMasterGridViewTemplate();
        }
    }

 public class MyMasterGridViewTemplate : MasterGridViewTemplate
    {
        public override void Copy()
        {
            base.Copy();

            GridViewCellInfo[] cells = null;
            if (this.SelectionMode == GridViewSelectionMode.CellSelect)
            {
                cells = new GridViewCellInfo[this.SelectedCells.Count];
                this.SelectedCells.CopyTo(cells, 0);
            }
            else if (this.SelectionMode == GridViewSelectionMode.FullRowSelect)
            {
                GridViewDataRowInfo row = this.SelectedRows[0] as GridViewDataRowInfo;
                if (this.SelectedRows.Count == 1 && row.ViewTemplate.CurrentColumn != null)
                {
                    cells = new GridViewCellInfo[row.Cells.Count];
                    for (int i = 0; i < row.Cells.Count; i++)
                    {
                        cells[i] = row.Cells[i];
                    }
                }
            }

            if (Clipboard.GetData(DataFormats.Text) != null)
            {
                string data = Clipboard.GetData(DataFormats.Text).ToString();
                if (data != string.Empty && cells != null)
                {
                    var values = data.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);

                    StringBuilder sb = new StringBuilder();
                    foreach (string value in values)
                    {
                        DateTime date;
                        if (DateTime.TryParse(value, out date))
                        {
                            string baseFormat = "yyyy-MM-dd HH:mm tt";
                            foreach (var cell in cells)
                            {
                                if (cell.ColumnInfo is GridViewDateTimeColumn && ((DateTime)cell.Value).ToString(baseFormat) == date.ToString(baseFormat))
                                {
                                    sb.Append(string.Format(((GridViewDateTimeColumn)cell.ColumnInfo).FormatString, cell.Value) + "\t");
                                    break;
                                }
                            }
                        }
                        else
                        {
                            sb.Append(value + "\t");
                        }
                    }

                    Clipboard.Clear();
                    Clipboard.SetData(DataFormats.Text, sb.ToString());
                }
            }
        }
    }
Completed
Last Updated: 06 Jun 2016 08:05 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 0
Category: GridView
Type: Bug Report
3
To reproduce: follow the steps defined in the following help article: http://docs.telerik.com/devtools/winforms/gridview/hierarchical-grid/tutorial-binding-to-hierarchical-data
Then, add a nested template in the second level. After closing the GridViewTemplate Collection Editor, you will notice that the template is not saved.

http://screencast.com/t/7VDYiopuUHn

Workaround: setup the hierarchy programmatically :  http://docs.telerik.com/devtools/winforms/gridview/hierarchical-grid/binding-to-hierarchical-data-programmatically
Completed
Last Updated: 14 Feb 2017 14:13 by ADMIN
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.
Completed
Last Updated: 20 Oct 2016 15:46 by ADMIN
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);
    }
}

Completed
Last Updated: 22 Feb 2016 07:59 by ADMIN
To reproduce:

public Form1()
{
    InitializeComponent(); 
    List<Item> items = new List<Item>();
    items.Add(new Item(1,"sample"));
    items.Add(new Item(2, null));
    items.Add(new Item(3, "sample2"));
    this.radGridView1.DataSource = items;
    this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
    this.radGridView1.EnableFiltering = true;
    this.radGridView1.ShowFilteringRow = false;
    this.radGridView1.ShowHeaderCellButtons = true; 
}

public class Item
{
    public int Id { get; set; }

    public string Description { get; set; }

    public Item(int id, string description)
    {
        this.Id = id;
        this.Description = description;
    }
}

Workaround: If possible, instead of using null value, use empty string.
If not possible, you will have to employ 3 classes - MyFilterMenuTreeElement, MyFilterMenuTreeItem, MyListFilterPopup. The classes are provided in the attached project RadGridViewFiltering.zip. Once you add the classes to your project, all you have to do is to replace the default popup with the new one, in the FilterPopupRequired handler: 
		private void RadGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e)
        {
            if (e.FilterPopup is RadListFilterPopup)
            {
                e.FilterPopup = new MyListFilterPopup(e.Column);
            }
        }
		
The approach is also demonstrated in the attached project.
Completed
Last Updated: 08 Sep 2016 08:25 by Luigi
To reproduce:
- Assing context menu using one of the default properties.
Completed
Last Updated: 04 Nov 2015 06:17 by ADMIN
The example found here http://www.telerik.com/support/kb/winforms/gridview/details/high-performance-with-radgridview-and-virtual-mode-including-filtering-sorting-and-grouping, currently does not work. There should be a way for the example virtual grid to go past the current limitation in sorting, filtering and grouping.
Completed
Last Updated: 22 Jul 2015 14:32 by ADMIN
Steps to reproduce:

1. Add a GridViewDateTimeColumn to a grid.

2. Add rows where one or more rows should contain null as the columns value.

3. Sort the grid by the date time column. 



WORKAROUND:

Create a custom RadGridDateTimeConverter and assign it as the column's date type converter:

public class CustomRadGridDateTimeConverter : RadGridDateTimeConverter
{
    public CustomRadGridDateTimeConverter(GridViewDateTimeColumn column)
        : base(column)
    { }

    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
    {
        if (destinationType == typeof(DateTime) && value == null)
        {
            return DateTime.MinValue;
        }

        return base.ConvertTo(context, culture, value, destinationType);
    }
}



this.radGridView1.Columns["DateTime"].DataTypeConverter = new CustomRadGridDateTimeConverter(this.radGridView1.Columns["DateTime"] as GridViewDateTimeColumn);
Completed
Last Updated: 08 Jan 2015 12:02 by ADMIN
To reproduce:
1. Add text box and check box column to the grid. Add a filter descriptor to the text box column
2. Bind it to a DataTable with some data
3. Clear the columns
4. Add the columns once again => the exception will be thrown 

Workaround.

1. Create the following cell element:
    class MyHeaderCell : GridCheckBoxHeaderCellElement
    {
        public MyHeaderCell(GridViewColumn column, GridRowElement row)
            : base(column, row)
        {

        }

        protected override bool SetCheckBoxState()
        {
            if (this.ColumnIndex == -1)
            {
                return false;
            }

            return base.SetCheckBoxState();
        }
    }
2. Subscribe to the grid's CreateCell event
3. Put the modified cell in action:
        void radGridView_CreateCell(object sender, GridViewCreateCellEventArgs e)
        {
            if (e.CellType == typeof(GridCheckBoxHeaderCellElement))
            {
                e.CellType = typeof(MyHeaderCell);
            }
        }
Completed
Last Updated: 01 Jun 2015 06:58 by ADMIN
Add the ability to filter by empty values (not null values) just like in excel.
Completed
Last Updated: 11 Jan 2017 08:30 by ADMIN
ADMIN
Created by: Julian Benkov
Comments: 1
Category: GridView
Type: Feature Request
3
virtual filtering operation - detached filter GUI to support filtering in external datasource or possibility to replace the data in RadGridView control when new filter is applied.
Completed
Last Updated: 21 Jul 2011 10:31 by ADMIN
ADMIN
Created by: Julian Benkov
Comments: 0
Category: GridView
Type: Bug Report
3
Group Descriptors are added before adding rows in unbound mode and not using defer refresh or Begin/EndUpdate
test:
----------------------------------------------------
using System.ComponentModel;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace Lab.Grid
{
public partial class GridGroupInUnboundMode : MainForm
{
private RadGridView gridView = new RadGridView();
public GridGroupInUnboundMode()
{
InitializeComponent();
this.gridView.Dock = DockStyle.Fill;
this.gridView.Parent = this;
this.gridView.BringToFront();
gridView.GroupDescriptors.Add("Name", ListSortDirection.Ascending);
GridViewTextBoxColumn col = new GridViewTextBoxColumn();
col.HeaderText = col.Name = "Id";
col.DataType = typeof(int);
gridView.Columns.Add(col);
col = new GridViewTextBoxColumn();
col.HeaderText = col.Name = "Name";
col.DataType = typeof(string);
gridView.Columns.Add(col);
col = new GridViewTextBoxColumn();
col.HeaderText = col.Name = "Sum";
col.DataType = typeof(double);
gridView.Columns.Add(col);
}
protected override void OnButton1Click()
{
gridView.Rows.Add(1, "Ivan", 123.56);
gridView.Rows.Add(2, "Ivan", 372.90);
gridView.Rows.Add(3, "Peter", 500.00);
}
protected override void OnButton2Click()
{
gridView.Rows.Add(4, "George", 300.00);
gridView.Rows.Add(5, "George", 600.00);
gridView.Rows.Add(6, "George", 100.00);
gridView.Rows.Add(7, "Enzo", 78.00);
}
protected override void OnButton3Click()
{
gridView.Rows.Add(8, "Enzo", 100.00);
gridView.Rows.Add(9, "Enzo", 200.00);
gridView.Rows.Add(10, "Enzo", 300.00);
}
}
}
Completed
Last Updated: 07 Aug 2012 03:43 by ADMIN
Setting the FieldName of a column in the child template to "Products.Name" does not work properly.
Completed
Last Updated: 11 Oct 2011 02:45 by Svetlin
Create GridViewRowInfo's EnsureVisible method overload that expands all parent rows and ensures visibility of the row.
Completed
Last Updated: 21 Aug 2015 13:46 by ADMIN
Description: When we scroll the RadGridView from Top to Bottom and Bottom to Top the first record is cut off, if we click the refresh button then it will be displayed properly. 

To reproduce:
- add a RadGridView to a form
- add a RadButton to a form
- use the following code snippet:

public Form1()
        {
            InitializeComponent();

            radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None;
            radGridView1.EnableCustomFiltering = false;
            this.radGridView1.AutoSizeRows = true;

            radGridView1.Columns["CustomerID"].Width = 100;
            radGridView1.Columns["CompanyName"].Width = 150;
            radGridView1.Columns["ContactName"].Width = 150;
            radGridView1.Columns["Country"].Width = 100;
            radGridView1.Columns["Phone"].Width = 90;
            radGridView1.Columns["Fax"].Width = 90;

            radGridView1.Columns["Phone"].AllowFiltering = false;
            radGridView1.Columns["Fax"].AllowFiltering = false;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'nwindDataSet.Customers' table. You can move, or remove it, as needed.
            this.customersTableAdapter.Fill(this.nwindDataSet.Customers);

        }

        private void radButton1_Click(object sender, EventArgs e)
        {
            Form1_Load(sender, e);
        }
Completed
Last Updated: 31 Mar 2014 09:22 by ADMIN
To reproduce: - add RadGridView and populate manually with hierarchical data; 

- BestFitColumns method of the child template does not work as expected; 

#1 scenario: radGridView1.MasterTemplate.ExpandAll(); radGridView1.Templates[0].ExpandAll(); radGridView1.Templates[0].BestFitColumns(BestFitColumnMode.AllCells); You will notice that some of the columns in the child template are not wide enough to show the whole cell content; 

#2 scenario: Subscribe to the ChildViewExpanded event and call BestFitColumns: private void radGridView1_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e) { e.ChildViewInfo.ViewTemplate.BestFitColumns(BestFitColumnMode.AllCells); } 

As a result the firstly expanded child view adjusts child template columns width and if you expand another child view which needs greater columns width, it is not displayed correctly. 

Workaround: determine the column width according to the longest cell content: foreach (GridViewDataColumn col in radGridView1.Templates[0].Columns) { BestFitAllCells(col); } private void BestFitAllCells(GridViewColumn column) { MasterGridViewTemplate masterTemplate = column.OwnerTemplate.Parent as MasterGridViewTemplate; if (masterTemplate == null) { return; } RadGridView grid = masterTemplate.Owner; IVirtualizedElementProvider<GridViewRowInfo> rowProvider = grid.TableElement.RowElementProvider; IVirtualizedElementProvider<GridViewColumn> cellProvider = grid.TableElement.ColumnScroller.ElementProvider; float width = 0; foreach (GridViewRowInfo dataRow in column.OwnerTemplate.Rows) { GridRowElement row = rowProvider.GetElement(dataRow, null) as GridRowElement; row.InitializeRowView(grid.TableElement); row.Initialize(dataRow); row.UpdateInfo(); grid.TableElement.Children.Add(row); row.ResetLayout(true); GridVirtualizedCellElement cell = cellProvider.GetElement(column, row) as GridVirtualizedCellElement; cell.Attach(column, row); cell.SetContent(); cell.UpdateInfo(); row.Children.Add(cell); GridHeaderCellElement headerCell = cell as GridHeaderCellElement; if (headerCell != null) { headerCell.UpdateArrowState(); } cell.ResetLayout(true); width = Math.Max(width, this.GetCellDesiredWidth(cell)); row.Children.Remove(cell); grid.TableElement.Children.Remove(row); this.Detach(cellProvider, cell); this.Detach(rowProvider, row); } width = Math.Max(width, TextRenderer.MeasureText(column.HeaderText, grid.Font).Width); column.Width = (int)width; } private float GetCellDesiredWidth(GridCellElement cell) { cell.Measure(new SizeF(float.PositiveInfinity, float.PositiveInfinity)); return cell.DesiredSize.Width; } private void Detach(IVirtualizedElementProvider<GridViewColumn> elementProvider, GridCellElement cell) { GridVirtualizedCellElement virtualizedCell = cell as GridVirtualizedCellElement; if (virtualizedCell != null) { elementProvider.CacheElement(virtualizedCell); virtualizedCell.Detach(); return; } cell.Dispose(); } private void Detach(IVirtualizedElementProvider<GridViewRowInfo> elementProvider, GridRowElement row) { GridVirtualizedRowElement virtualizedRоw = row as GridVirtualizedRowElement; if (virtualizedRоw != null) { elementProvider.CacheElement(virtualizedRоw); virtualizedRоw.Detach(); return; } row.Dispose(); } 
Completed
Last Updated: 12 Apr 2012 04:14 by ADMIN
When a user groups the grid by a certain column and then attempts to drag the column back to the header, column reorder is possible, even though the AllowColumnReorder  is false.
Completed
Last Updated: 21 May 2012 08:30 by ADMIN
FIX. RadGridView - exception when BestFitColumns is called during data update
Completed
Last Updated: 13 Oct 2014 09:53 by Jesse Dyck
RadGridView is throwing exception when loading layout that contains a GroupDescriptor with predefined Format with Aggregate function.

Steps to reproduce:

1. Add GroupDescriptor:
        Dim descriptor As New GroupDescriptor
        descriptor.GroupNames.Add("column3", System.ComponentModel.ListSortDirection.Ascending)
        descriptor.Aggregates.Add("Sum(column3)")
        descriptor.Format = "{0}: {1} Total montant : {2:c2}"
        Me.RadGridView1.GroupDescriptors.Add(descriptor)
2. Save Layout
3. Load Layout