WPF RadGridView Columns DataMemberBinding error with DataRowView in newest update 2021.2.615

1 Answer 292 Views
GridView
Ivars
Top achievements
Rank 1
Ivars asked on 15 Jul 2021, 10:06 AM

We use long time RadGridView with ItemsSource  as  System.Data.DataTable.DefaultView

In newest update 2021.2.615 column names with Case sensitive difference (orig. [reg_dat]) make Binding error

 

<telerik:GridViewDataColumn Header="Reg.date"   DataMemberBinding="{Binding [Reg_dat]}" />

 

Cannot obtain IDataErrorInfo.Error[[Reg_dat]] from source of type System.Data.DataRowView - System.ArgumentException 'Column '[Reg_dat]' does not belong to table .' BindingExpression:Path=[Reg_dat]; DataItem='DataRowView' (HashCode=51788984); target element is 'GridViewCell' (Name=''); target property is 'ValueChangedListener' (type 'Object')

 

It is Telerik mistake?

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 20 Jul 2021, 07:53 AM

Hi Ivars,

Thank you for the provided details.

In your post, you mentioned that after the update is not working. Do you mean that it was working before that? Generally, speaking RadGridView's data engine operates either by using the default WPF data-binding mechanism or by extracting the property descriptors of the public properties of the bound type, using them to create member access expressions for these properties. For performance purposes, the default data-binding mechanism is used in cases when you have nested properties. For the general case, we create an expression which in your case, is not getting the data correctly. However, you can easily workaround this by creating custom DataTemplates for CellTemplate and CellEditTemplate properties. 

. . . .
<telerik:GridViewDataColumn Header="a" DataMemberBinding="{Binding a}">
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding a}"/>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
    <telerik:GridViewDataColumn.CellEditTemplate>
        <DataTemplate>
            <TextBox Text="{Binding a}"/>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
. .. . 

The TextBlock can be bound to your property. Give this a try and let me know how it goes.

If the above approach is not working for you, may I ask you to create a sample project which mimics your implementation and send it back to me?

Regards,
Dinko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Ivars
Top achievements
Rank 1
commented on 20 Jul 2021, 09:02 AM

We use TextBlock/TextBox/RadGridView.Columns Text property binding to System.Data.DataRowView without problems of database table columns names as sample: "{Binding [Reg_dat]}" or "{Binding [reg_dat]}".
After last updates all is working fine, except RadGridView column Header object is demaged.

In execution mode I see data in RadGridView, but is binding warning for each row and column Header is without filter and sort icons. DataMemberBinding for columns value is correct and for column Header - incorrect.
We can change binding expression, but this is lot of work and testing.
Dinko | Tech Support Engineer
Telerik team
commented on 23 Jul 2021, 06:48 AM

May I ask you to share an image of the column headers? If the filter icon is missing, the grid could not get the correct type of property. Another case would be that you have a custom implicit style which is overriding the filter and sort icons. Could it be possible to isolate this in a standalone project? This way I can have a better look at this behavior.
Ivars
Top achievements
Rank 1
commented on 26 Jul 2021, 08:00 AM

See attached WPF NET framework VS2019 TEST project with RadGridView and DataTable with original column [Name]
<telerik:GridViewDataColumn Header="Name1" DataMemberBinding="{Binding [name]}"/>
<telerik:GridViewDataColumn Header="Name2" DataMemberBinding="{Binding [Name]}"/>
<telerik:GridViewDataColumn Header="Name3" DataMemberBinding="{Binding name}"/>
<telerik:GridViewDataColumn Header="Name4" DataMemberBinding="{Binding Name}"/>

Telerik Update 2021.2: Name1-bad header, Name2-OK, Name3-no value, Name4-OK
Telerik Update 2021.1: Name1-OK, Name2-OK, Name3-OK, Name4-OK
Telerik Update 2019.*: Name1-OK, Name2-OK, Name3-no value, Name4-no value

We use last 3 years in projects for DataTable syntax {Binding [name]} , without Case sensitivity.
TEST: http://net.datorika.lv/downloads/TelerikWpfApp1_RadGridView.zip (10Kb)
Dinko | Tech Support Engineer
Telerik team
commented on 28 Jul 2021, 12:16 PM

Thank you for the provided details. I was able to observe the described behavior. I have overlooked this behavior and I apologize for not seeing it in your first post. Recently we have made some changes regarding the binding of GridViewDataColumn. So far the binding was case insensitive and we have received cases where this behavior is undesired. Here is the related feedback item. From the 2021.2.525 version of our controls, the binding in GridViewDataColumn is case-sensitive. This behavior is similar to the MS DataGrid. After a discussion, it was decided that our RadGridView control should behave the same way as the DataGrid. With the versions after 2021.2.525 you will need to specify the name of the property/DataTable column the way it is specified in code. Otherwise, the RadGridView will not show any data or apply the filter and sorting behavior correctly.

Narayan
Top achievements
Rank 1
commented on 11 Aug 2022, 12:15 PM

Hello Team, We have upgrade our application from  2020.3.1020 to 2022.1.222 and we are facing same problem. Have many instances in application of case insensitive. Is there any workaround to continue with insensitive with latest version.
Stenly
Telerik team
commented on 16 Aug 2022, 07:55 AM

Hello Narayan,

As mentioned by my colleague, Dinko, we have updated the binding for the GridViewDataColumn to be case-sensitive, due to several reports where the case-insensitive behavior was undesired. This behavior is present in versions after the 2021.2.525 version.

Currently, there is no option to keep the case-insensitive binding. The only thing that comes to my mind would be to find each column that produces the binding error and update the DataMemberBinding property to be case-sensitive.

Tags
GridView
Asked by
Ivars
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or