Unable to bind a List to a Data Grid

Hi Guys

I hope you can help.

I want to bind a List object to the Data Grid, the List is manually created and not bound to a DB result, but I get the following error:

I have a master detail page that I have manually created. The detail section requires the users to select from a drop down (the type) then enter a description. Pressing Add, adds the data to an item in the List. I then want the List displayed in the gird.

Here is the definition of the class for the List item…

Here’s the Add event….

and the grid columns, where you can see the properties appear ok…

!

Finally, here is the error in VS..

What have I done wrong, a List implements IEnumerable, so I don’t get the VS error and the Radzen error Invalid expression term ‘>’ doesn’t help either.

Nothing is written to the DB until the whole page is completed.

Please advise.

Try adding a custom attributer with name TItem and value Recroledetailview. We will investigate why Radzen can't handle this case properly.

Hi Korchev

That didn't make any difference.

Thanks

Have you had a chance to investigate this issue yet?

Hi @MikeT,

According to this screenshot:

you are trying to assign IEnumerable<IList<T>> to DataGrid Data property while you need only IEnumerable<T>. The grid cannot be bound to collection of collections. What is your TItem attribute at the moment?

I'm not binding it to a collection of collections, Radzen is adding that code. Look at the Set Property snippet, I'm binding it to a list, which is the TItem:

details = new List<Recroledetaillview>();

No complaints in the code.

The columns don't have an issue with the list and I can add the properties.

I can't see what I've done wrong.

We investigated the issue and confirm it is a bug in Radzen. The following is a viable workaround:

  1. Open the Set property action that initializes the details property and change Property type from List<Recroledetailview> to IEnumerable<Recroledetailview>
  2. Select the DataGrid and clear its Data property.
  3. Set it again to ${details}.

We will try to fix the problem with incorrectly inferring the argument of List properties.

Thank you, I will give it a go and let you know if it works ok.

Unfortunately that didn't work either.

The error in the grid went from:

To:

I'll have to wait until you have a fix.

Thank you for your help.

The fix we will release will require you to recreate the property and datagrid in a similar manner.

Another easy fix is to edit the json file of your page and change "itemType" to Recroledetailview.

It looks like changing the JSON file works as a workaround.

Thanks