Hello,
I'm trying to sort a GridView by a property of a child object. I'm able to successfully set the DataField of a BoundField to the child column ("Application.Name"), but this doesn't work for sorting. How would I go about accessing this child property in the ApplySort method of a SortedBindingList?
Thanks,
Sam Johnson
Hi,
SortedBindingList does not support sorting on a child property. Only properties on the actual object may be used for sorting.
So you could add an extra property to the list to project the child property or to use LINQ with projection but that requires more code in the UI and does not support editing of the list.
Thank you! Using this, I was simply able to add the following property to the object and was able to sort:
public string ApplicationName { get { return this.Application.Name; } }
Copyright (c) Marimer LLC