Completed
Last Updated: 27 Mar 2023 06:39 by ADMIN
Release R1 2023 SP1

An exception occurs when trying to export the RadGridView using the ExportToPDF class with the following message.

System.SystemException: 'System.MethodAccessException: Attempt by security transparent method 'Telerik.Pdf.Gdi.GdiFontEnumerator.get_FamilyNames()' to call native code through method 'Telerik.WinControls.NativeMethods.EnumFontFamiliesEx(IntPtr, LOGFONT, FontEnumDelegate, Int32, Int32)' failed.  Methods must be security critical or security safe-critical to call native code.
   at Telerik.Pdf.Gdi.GdiFontEnumerator.get_FamilyNames()
   at Telerik.Apoc.Pdf.FontSetup.AddSystemFonts(FontType fontType)
   at Telerik.Apoc.Render.Pdf.PdfRenderer.SetupFontInfo(FontInfo fontInfo)
   at Telerik.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)'

This exception is observed only when the referenced DLLs target the .Net Framework 4.8 version.

Completed
Last Updated: 31 Jan 2024 11:39 by ADMIN
Release 2024 Q1 (2024.1.130)
Created by: Walker
Comments: 2
Category: GridView
Type: Feature Request
3
Show summary row values in collapsed groups.
Completed
Last Updated: 02 Feb 2023 09:36 by ADMIN
Release R1 2023
NullReferenceException is thrown the control is focused and RadCheckDropDownListElement is used as a custom editor.
Unplanned
Last Updated: 14 Nov 2022 20:41 by ADMIN

In this particular scenario, the RadDropDownListEditor element inside the RadComboBoxColumn cell contains an empty string item. So when we try to clear the value of the cell and leave it empty, the internal logic will return the last selected valid value. The following code demonstrate a simple example:

DataTable dt = new DataTable();
dt.Columns.Add("id", typeof(int));
dt.Columns.Add("codice", typeof(string));
dt.Columns.Add("nome", typeof(string));

dt.Rows.Add(0, "", "");
dt.Rows.Add(1, "I622", "Seravezza");
dt.Rows.Add(2, "G628", "Pietrasanta");
dt.Rows.Add(3, "L833", "Viareggio");

The first row in the DataTable which the RadGridView contains an empty value. If for example, the second row is selected and we use Backspace/Delete to clear the text and move to another cell. The selected item won't be changed. The cell value won't be cleared. To workaround this we could avoid using empty strings. We could use space or some other symbol to allow the user to clear the value from the drop-down popup.

dt.Rows.Add(0, "", "-");
OR
dt.Rows.Add(0, "", " ");

Completed
Last Updated: 27 Mar 2023 06:39 by ADMIN
Release R1 2023 SP1

Steps to reproduce:

1. Bind the grid and enable the search row

2. Enter some search text

3. Delete records from the applied DataSource collection. It may be necessary to perform the delete operation several times before the error occurs.

The error can be reproduced with the following code snippet: 

    Dim dt As New DataTable
    Sub New()

        InitializeComponent()

        dt.Columns.Add("Id", GetType(Integer))
        dt.Columns.Add("Name", GetType(String))
        For index = 1 To 10000
            dt.Rows.Add(index, Guid.NewGuid.ToString())

        Next
        Me.RadGridView1.DataSource = dt
        Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill

        Me.RadGridView1.AllowSearchRow = True

    End Sub

    Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
        For index = 1 To 50
            dt.Rows.RemoveAt(0)
        Next
    End Sub

There is a sample project attached as well and its result is illustrated in the gif file.

Stack trace:

   at Telerik.WinControls.UI.MasterGridViewTemplate.set_CurrentRow(GridViewRowInfo value)
   at Telerik.WinControls.UI.RadGridView.set_CurrentRow(GridViewRowInfo value)
   at Telerik.WinControls.UI.GridViewSearchRowInfo.SetCurrent(GridSearchResultCellInfo cell)
   at Telerik.WinControls.UI.GridViewSearchRowInfo.SetCurrent(GridSearchResultCellInfo cell, Boolean checkInvokeRequired)
   at Telerik.WinControls.UI.GridViewSearchRowInfo.SelectNextSearchResult()
   at Telerik.WinControls.UI.GridViewSearchRowInfo.Search(String criteria)
   at Telerik.WinControls.UI.GridViewSearchRowInfo.Telerik.WinControls.UI.IGridViewEventListener.PostProcessEvent(GridViewEvent eventData)
   at Telerik.WinControls.UI.GridViewEventProcessEntity.ProcessCollection(GridViewEvent gridEvent, PriorityWeakReferenceList list, GridEventProcessMode processMode)
   at Telerik.WinControls.UI.GridViewSynchronizationService.NotifyListeners(GridViewEvent gridEvent)
   at Telerik.WinControls.UI.GridViewSynchronizationService.FlushEvents()
   at Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewEvent gridEvent)
   at Telerik.WinControls.UI.GridViewSynchronizationService.DispatchEvent(GridViewTemplate template, GridViewEvent eventData, Boolean postUI)
   at Telerik.WinControls.UI.GridViewRowCollection.DispatchDataViewChangedEvent(DataViewChangedEventArgs args, GridEventType type)
   at Telerik.WinControls.UI.GridViewRowCollection.ListSource_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Telerik.WinControls.Data.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at Telerik.WinControls.Data.RadListSource`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.WinControls.Data.RadListSource`1.RemoveItem(Int32 index)
   at Telerik.WinControls.Data.RadListSource`1.currencyManager_ListChanged(Object sender, ListChangedEventArgs e)
   at System.Windows.Forms.CurrencyManager.OnListChanged(ListChangedEventArgs e)
   at System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e)
   at System.Windows.Forms.BindingSource.OnListChanged(ListChangedEventArgs e)
   at System.Windows.Forms.BindingSource.InnerList_ListChanged(Object sender, ListChangedEventArgs e)
   at System.ComponentModel.BindingList`1.OnListChanged(ListChangedEventArgs e)
   at System.ComponentModel.BindingList`1.FireListChanged(ListChangedType type, Int32 index)
   at System.ComponentModel.BindingList`1.RemoveItem(Int32 index)
   at System.Collections.ObjectModel.Collection`1.Remove(T item)
   at System.Collections.ObjectModel.Collection`1.System.Collections.IList.Remove(Object value)
   at System.Windows.Forms.BindingSource.Remove(Object value)

 

Unplanned
Last Updated: 28 Oct 2022 12:36 by Daniel

In this case, the GridViewCheckBoxColumn is nullable bool? property and the ThreeState property is set to true. When we try to use the filter context menu to filter the cell by null values, the filter is not applied.

Unplanned
Last Updated: 25 Oct 2022 09:03 by ADMIN

Steps to reproduce:

1. Please run the attached sample project

2. Filter grid so only one row is left

3.Copy the first cell with the content menu. The following error occurs:

************** Exception Text **************
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Telerik.WinControls.UI.MasterGridViewTemplate.CopySelected(GridViewCellInfo[] cells, String format, Boolean cut, Boolean cutOperation, StringBuilder content) in C:\Work\Development\RadControls\RadGridView\Code\Data\MasterGridViewTemplate.cs:line 1491
   at Telerik.WinControls.UI.MasterGridViewTemplate.ProcessContent(String format, Boolean cut, Boolean cutOperation) in C:\Work\Development\RadControls\RadGridView\Code\Data\MasterGridViewTemplate.cs:line 1291
   at Telerik.WinControls.UI.MasterGridViewTemplate.CopyContent(Boolean cut) in C:\Work\Development\RadControls\RadGridView\Code\Data\MasterGridViewTemplate.cs:line 1256
   at Telerik.WinControls.UI.MasterGridViewTemplate.Copy() in C:\Work\Development\RadControls\RadGridView\Code\Data\MasterGridViewTemplate.cs:line 2066
   at Telerik.WinControls.UI.GridDataCellElement.ItemCopy_Click(Object sender, EventArgs e) in C:\Work\Development\RadControls\RadGridView\Code\UI\GridViews\TableView\Cells\GridDataCellElement.cs:line 380
   at Telerik.WinControls.RadElement.OnClick(EventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 5096
   at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e) in C:\Work\Development\RadControls\RadControlsUI\UIElements\Buttons\RadButtonItem.cs:line 566
   at Telerik.WinControls.UI.RadMenuItem.OnClick(EventArgs e) in C:\Work\Development\RadControls\RadControlsUI\Menu\RadMenuItem.cs:line 685
   at Telerik.WinControls.RadElement.DoClick(EventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 5160
   at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 4274
   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadItem.cs:line 779
   at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 4181
   at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 5273
   at Telerik.WinControls.RadElement.CallDoMouseUp(MouseEventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Element\RadElement.cs:line 5495
   at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Control\ComponentInputBehavior.cs:line 75
   at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e) in C:\Work\Development\RadControls\RadControl\TPF\Control\RadControl.cs:line 1206
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Telerik.WinControls.RadControl.WndProc(Message& m) in C:\Work\Development\RadControls\RadControl\TPF\Control\RadControl.cs:line 1550
   at Telerik.WinControls.UI.RadPopupControlBase.WndProc(Message& m) in C:\Work\Development\RadControls\RadControlsUI\GenericPopup\RadPopupControlBase.cs:line 795
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Unplanned
Last Updated: 11 Oct 2022 11:31 by ADMIN

GridViewCellInfo offers Style property which allows you to customize the style for the cells defined at the data cell's level: https://docs.telerik.com/devtools/winforms/controls/gridview/cells/formating-examples/style-property

This functionality should work for the header cells as well like this:

            GridViewCellInfo cell = this.radGridView1.MasterView.TableHeaderRow.Cells[0];
            cell.Style.CustomizeFill = true;
            cell.Style.GradientStyle = GradientStyles.Solid;
            cell.Style.BackColor = System.Drawing.Color.FromArgb(162, 215, 255);

 

Completed
Last Updated: 02 Feb 2023 09:39 by ADMIN
Release R3 2022 SP2

When you use var, object is assumed. Of course, the object contains a GridViewCellInfo, but you have to cast it first to use one of its members.

The goal is to prevent unnecessary casts.

Unplanned
Last Updated: 19 Sep 2022 07:58 by Ark Technologies
When the Space key is pressed GridCheckBoxCellElement enters edit mode although the EditMode property is set to OnValueChange. 
Completed
Last Updated: 21 Sep 2022 12:57 by ADMIN
Release R3 2022 SP1
Please run the attached sample project and click one of the column headers. You will notice that the column is not sorted.
Declined
Last Updated: 16 Feb 2024 22:24 by ADMIN

C#. net core 6, winforms application, TekerikNuGet3 package source, UI.for.WinForms.AllControls.NetCore package 2022.2.622

I am trying to export selected cells from a RadGridView as a csv file.

When using "var exporter = new ExportToCSV(Dgv)" then "exporter.RunExport(fileName);" writes the csv file correctly. It exports every cell.

It doesn't support exporting selections so I wrote a function to do this . The one below is what I used in my project to test what I was doing. It initially writes the csv to a worksheet and wrote that using formatprovider to file, then I just created a stringbuilder adding quotes and appended that to the file afterwards.

Writing the worksheet, the csv values haven't been quoted, plus number fields have had leading zeros removed which proves to be a problem when telephone numbers are stored in a field.

So I googled and found the Settings property which is there to set csv options. But they are private, not public therefore I can't set up the csv propertly.

private void radButton1_Click(object sender, EventArgs e)
  {

    var workbook = new Workbook();
    var worksheet = workbook.Worksheets.Add();

    var rowIndex = 0;
    var columnIndex = -1;
    var sb = new StringBuilder();
    var prevColumnIndex = -1;

    // ForEach cell are accessed vertically then horizontally.
    foreach (var cell in Dgv.SelectedCells)
    {
      // Cell is included in selection even if it's invisible
      // so check visibility and ignore if it isnt
      if (!cell.ColumnInfo.IsVisible) continue;

      // At bottom of column, rownum will change. Watch for this
      // and reset x and y values
      var rowNum = cell.RowInfo.Index;
      if (rowNum != prevColumnIndex)
      {
        prevColumnIndex = rowNum;
        rowIndex = 0;
        columnIndex++;
        sb.AppendLine("");
      }
      else if (!string.IsNullOrEmpty(sb.ToString()))
        sb.Append(",");

      var value = cell.Value;
      worksheet.Cells[columnIndex, rowIndex++ ].SetValue(value.ToString());
      sb.Append($"\"{value.ToString()}\"");
    }

    var fileName = @"C:\temp\SampleFile.csv";

    IWorkbookFormatProvider formatProvider = new CsvFormatProvider();
    using var output = new FileStream(fileName, FileMode.Create);
    formatProvider.Export(workbook, output);
    output.Close();

    // Write contents of sb to the file for comparison sake
    File.AppendAllText(fileName, sb.ToString());

  }

Completed
Last Updated: 13 Nov 2024 12:45 by ADMIN
Release 2024.4.1113 (2024 Q4)

Run the attached project on a monitor with 100% DPI scaling and open the Excel-like filter popup:

100%:

After moving the form to the second monitor with 150% DPI scaling, the filter popup is not OK:

150%:

The popup is smaller and smaller with each next opening (see the attached gif file) at 150%. If you decide to move back the form on the monitor with 100% DPI scaling, the filter popup is not scaled properly.

Completed
Last Updated: 23 Sep 2022 13:07 by ADMIN
Release R3 2022

ArgumentOutOfRangeException is thrown when the control is auto-sized (AutoSize = true) and we try to select all (MultiSelect = true with CellSelect) rows by clicking and moving the mouse. 

As a workaround, we could set the MaximumSize property of the RadGridView.

this.radGridView1.MaximumSize = new Size(1000,1000);

Completed
Last Updated: 23 Sep 2022 13:07 by ADMIN
Release R3 2022

Run the attached sample project on a monitor with 100% DPI scaling. Then, try moving the form to the second monitor with 150% DPI scaling. You will notice that the following error occurs:

Workaround: instead of using a RadTextBoxControlElement in the custom cell, feel free to use a RadTextBoxElement. However, please have in mind that RadTextBoxElement hosts the MS TextBox and using controls in grid cells may slow down the scrolling and will cause visual glitches as they do not support clipping.

Completed
Last Updated: 23 Sep 2022 13:07 by ADMIN
Release R3 2022
When the MultiSelect property is false and the SelectionMode is set to CellSelect, clicking on the row header, all cells in the row will be selected. In this case, only the current cell in the same column needs to be changed. 
Completed
Last Updated: 23 Sep 2022 13:07 by ADMIN
Release R3 2022
The event handlers of these events are not correctly implemented. A NullReferenceException could raise if a task executed on a different thread unsubscribes from the event.
Completed
Last Updated: 31 Jan 2024 11:39 by ADMIN
Release 2024 Q1 (2024.1.130)

When the columns are auto-generated, the way to modify the columns is to use the Columns collection. We could expose an event that will be called when the columns are auto-generating. From the event arguments, we could get the newly created column and replace with if needed or modify it. Similar to the CreateRow event of the control.

Completed
Last Updated: 11 Oct 2022 08:07 by ADMIN
Release R3 2022
Class GridViewRowCollection implements IList<T>.

Class GridViewCellInfoCollection does not implement any generic interfaces.
Unplanned
Last Updated: 08 Jun 2022 07:52 by Suresh

Use the following code snippet:

        public RadForm1()
        {
            InitializeComponent();
            this.radGridView1.Columns.Add("TextColumn");
            this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;

            for (int i = 0; i < 30; i++)
            {
                this.radGridView1.Rows.Add(Guid.NewGuid().ToString());
            }
            this.radGridView1.CellValidating += radGridView1_CellValidating;

            this.radGridView1.EditorManager.CloseEditorWhenValidationFails = false;
        }

        private void radGridView1_CellValidating(object sender, CellValidatingEventArgs e)
        {
            if (e.Value == null || e.Value == "")
            {
                e.Cancel = true;
                RadMessageBox.Show("Value can't be empty!");
            }
        }

Steps:

1. Clear the value of a cell

2. While the editor is active with an empty value, click the vertical scrollbar to trigger scrolling.

Actual: the scrolling is performed and the editor is closed with the previous value no matter when the validation fails and the CloseEditorWhenValidationFails property is set to false.

Expected: the scrolling should be blocked if the validation fails. We should offer the same behavior when scrolling with the mouse wheel, clicking another cell or clicking the vertical scrollbar (or any of its elements).

Workaround: 

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

            protected override void OnMouseDown(MouseEventArgs e)
            {
                RadScrollBarElement scrollBarAtPoint = GetScrollbarElementAtPoint<RadScrollBarElement>(this.GridViewElement.ElementTree, e.Location) as RadScrollBarElement;
                GridViewEditManager editManager = this.EditorManager;
                if (scrollBarAtPoint != null && this.ActiveEditor != null && !editManager.CloseEditorWhenValidationFails)
                {
                    bool isClosed = editManager.CloseEditor();
                    if (!isClosed)
                    {
                        return;
                    }
                }
                base.OnMouseDown(e);
            }

            internal T GetScrollbarElementAtPoint<T>(RadElementTree componentTree, Point point) where T : RadElement
            {
                if (componentTree != null)
                {
                    RadElement elementUnderMouse = componentTree.GetElementAtPoint(point);

                    while (elementUnderMouse != null)
                    {
                        T item = elementUnderMouse as T;

                        if (item != null)
                        {
                            return item;
                        }

                        elementUnderMouse = elementUnderMouse.Parent;
                    }
                }

                return null;
            }
        }