ASP.NET GridView sorting on method data
I'm binding a GridView to a domain model object, this domain model object has a method for working out a formatted value to display on the grid. I'd like to use this method for my display value, which is fine, but I'd also like to be able to sort on the value returned by开发者_运维问答 that method. My sort expression can only take in a property/field at the moment.
Help please! What do I need to do to get this to work?
I'm using an SPGridView actually, but that doesn't make a lot of difference to my problem.
Thanks.
The databinding can only occur against properties (not methods), so you could make a property that calls your custom display method and returns its output.
精彩评论