Column with complex binding disable filtering and ordering.

0 Answers 22 Views
GridView
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Deltaohm asked on 20 Feb 2024, 04:54 PM | edited on 21 Feb 2024, 07:50 AM
Hello
I have a radgridview with two columns (for simplicity)
The first is defined like this:

RiassuntoSorgentiGrid.Columns.Add(new GridViewDataColumn()
{
				Header = Utility.LoadString(ResourcesKeys.RipetizioniSorgente),
				ColumnGroupName = GENERALGROUPNAME,
				DataFormatString = "D",
				DataMemberBinding = new Binding("Sorgente.Ripetizioni")
				{
					Mode = BindingMode.OneWay
				}
});


The second like this:

RiassuntoSorgentiGrid.Columns.Add(new GridViewDataColumn()
{
				Header = Utility.LoadString(ResourcesKeys.RipetizioniSorgente),
				ColumnGroupName = GENERALGROUPNAME,
				DataFormatString = "D",
				DataMemberBinding = new Binding($"Sorgente.LivelliSingoli[{parametro.Id}][{l}]")
				{
					Mode = BindingMode.OneWay
				}
});


where parametro.Id and l are variables correctly defined and not null.
The grid works good, but in the second columns filtering and sorting are not active, while in the first they do.

Is there a reason for this behavior?
Thank you
Luigi
Dimitar
Telerik team
commented on 21 Feb 2024, 08:55 AM

Hi Luigi, 

What is the type of property used in this case? Can you create a small sample project that reproduces this case and send it to us? This will allow us to properly investigate this and provide a solution. 

Thank you in advance for your patience and cooperation. 

Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 21 Feb 2024, 09:15 AM

Thank you for your quick answer.
It is not easy to extract the code and put it in a small project.
The LivelliSingoli property is defined as 

public Dictionary<string, Dictionary<LivelliSorgente, object>> LivelliSingoli { get; set; } = new();
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 21 Feb 2024, 09:17 AM

I would to add that I don't know in advance the key of the external dictionary and wich LivelliSorgenti are added in the internal dictionary.
LivelliSorgenti is an enumeration.
Dimitar
Telerik team
commented on 21 Feb 2024, 01:13 PM

Hi Luigi, 

This should work with an enumeration. Perhaps instead of object, you should use the actual enumeration type or at least set the DataType of the column. 

Let me know if I can be of further assistance. 

Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 21 Feb 2024, 04:09 PM

I set DataType for column and now it works.
Thank you

Luigi

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Share this question
or