Completed
Last Updated: 01 Nov 2022 13:07 by ADMIN
Release R3 2022 SP2
Martin
Created on: 08 Oct 2022 12:00
Category: UI for WinForms
Type: Bug Report
0
RadGridView: GridViewTemplate.SetError creates GridViewDataErrorEventArgs twice

The method GridViewTemplate.SetError creates in most situations an GridViewDataErrorEventArgs object twice.

Current code:

GridViewDataErrorEventArgs args = new GridViewDataErrorEventArgs(exception, 0, 0, GridViewDataErrorContexts.Commit);
if (e != null)
{
    args = new GridViewDataErrorEventArgs(exception, e.ColumnIndex, e.RowIndex, GridViewDataErrorContexts.Commit);
}

In assume in most cases e will not be null, so in must cases the first args will be removed. This has a small negative impact on memory and performace.

Suggestion:

GridViewDataErrorEventArgs args = e == null 
    ? new GridViewDataErrorEventArgs(exception, 0, 0, GridViewDataErrorContexts.Commit)
    : new GridViewDataErrorEventArgs(exception, e.ColumnIndex, e.RowIndex, GridViewDataErrorContexts.Commit);

1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 12 Oct 2022 12:48

Hi, Martin,

I have approved your suggestion for improving the SetError method and reduce the creation of GridViewDataErrorEventArgs to just once.

We will do our best to introduce the improvement in the upcoming releases. Stay tuned.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.