I am having trouble sorting when the SortExpression is set to Object[i].Property
Scenario:
My Site class has a property of type Collection<Estimate> Estimates
The Estimate class has a Decimal property called Total
After executing a search, I am binding the radGrid to a collection of Site objects that fit the criteria
ie: gvResults.DataSource = Collection<CustomSite.Site>
When executing the search query, the Estimate collection above gets filled with up to 3 types of estimates. One of these types is very important, and is always added to the collection in the first position.
When creating the grid, I have a column defined as
<telerik:GridBoundColumn DataField="Estimates[0].Total" HeaderText="Estimate Total" SortExpression="Estimates[0].Total" DataFormatString="{0:n0}" DataType="System.Decimal" HtmlEncode="False" HeaderStyle-Width="86px" ItemStyle-Width="86px" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Top" SortAscImageUrl="~/Images/sort-up.gif" SortDescImageUrl="~/Images/sort-down.gif" />
I have a second column defined the same way, it just binds to a different property
<telerik:GridBoundColumn DataField="Values.Equipment" HeaderText="Equipment" SortExpression="Values.Equipment" DataFormatString="{0:n0}" DataType="System.Decimal" HtmlEncode="False" HeaderStyle-Width="86px" ItemStyle-Width="86px" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Top" SortAscImageUrl="~/Images/sort-up.gif" SortDescImageUrl="~/Images/sort-down.gif" />
The cells in both cases are filled with the correct value after the search binds.
I have no trouble sorting on the Values.Equipment column. Ascending, descending, it works find both directions.
However, when I try to sort on the Estimates[0].Total column, I get very strange and entirely incorrect results.
The odd thing is that if I sort ASC, maybe one or two rows will shift from their default position, but not in the sort position specified. If I sort DESC, I may or may not get a change. If I sort ASC again, the rows may still stay the same, or they may shift to yet a different position from the first ASC sort and still different from the original sort.
Is it not possible to have a SortExpression defined as an indexed value of a collection (ie: Estimates[0].Total)
More code can be posted if necessary.
Scenario:
My Site class has a property of type Collection<Estimate> Estimates
The Estimate class has a Decimal property called Total
After executing a search, I am binding the radGrid to a collection of Site objects that fit the criteria
ie: gvResults.DataSource = Collection<CustomSite.Site>
When executing the search query, the Estimate collection above gets filled with up to 3 types of estimates. One of these types is very important, and is always added to the collection in the first position.
When creating the grid, I have a column defined as
<telerik:GridBoundColumn DataField="Estimates[0].Total" HeaderText="Estimate Total" SortExpression="Estimates[0].Total" DataFormatString="{0:n0}" DataType="System.Decimal" HtmlEncode="False" HeaderStyle-Width="86px" ItemStyle-Width="86px" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Top" SortAscImageUrl="~/Images/sort-up.gif" SortDescImageUrl="~/Images/sort-down.gif" />
I have a second column defined the same way, it just binds to a different property
<telerik:GridBoundColumn DataField="Values.Equipment" HeaderText="Equipment" SortExpression="Values.Equipment" DataFormatString="{0:n0}" DataType="System.Decimal" HtmlEncode="False" HeaderStyle-Width="86px" ItemStyle-Width="86px" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Top" SortAscImageUrl="~/Images/sort-up.gif" SortDescImageUrl="~/Images/sort-down.gif" />
The cells in both cases are filled with the correct value after the search binds.
I have no trouble sorting on the Values.Equipment column. Ascending, descending, it works find both directions.
However, when I try to sort on the Estimates[0].Total column, I get very strange and entirely incorrect results.
The odd thing is that if I sort ASC, maybe one or two rows will shift from their default position, but not in the sort position specified. If I sort DESC, I may or may not get a change. If I sort ASC again, the rows may still stay the same, or they may shift to yet a different position from the first ASC sort and still different from the original sort.
Is it not possible to have a SortExpression defined as an indexed value of a collection (ie: Estimates[0].Total)
More code can be posted if necessary.