This is a migrated thread and some comments may be shown as answers.

Sort by text contained in row with data that isn't databound

1 Answer 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas Salt
Top achievements
Rank 1
Thomas Salt asked on 21 Apr 2010, 06:39 PM
I have a grid with columns that are generated dynamically based on a specific dataset.  For example, if there are 6 records in my dataset then I will add 6 columns to a grid.  If there are 7 I would add 7 columns to the grid.  The columns I am generating are template columns that are being created on the server side.  In these columns there is either a red or green ball image displayed based on a certain criteria (a calculation performed in the constructor of my template).  Essentially this is leaving the columns un-databound to a specific field in the result set.

I am trying to sort these dynamically created columns so I could show all the green ball images on top or the other way around.  I figured the easiest way to do this would be to add a hidden column with each image template column I create.  So instead of creating 6 columns for my dataset I would create 12 with 6 of them being hidden.  In these hidden columns I could simple put the path to the ball images; either "redBall.gif" or "greenBall.gif".  The question is how do I then sort using one of the hidden columns?

Simply put: I want to sort by the text in a specific column (redBall.gif or greenBall.gif).  The problem I am running into is I do not have a DataField or SortExpression to bind the grid to.  I've looked at most, if not all, of the articles on Telerik and cannot find much help.

I appreciate any ideas.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 23 Apr 2010, 12:44 PM
Hello Thomas,

To achieve your goal you can try implementing custom sorting as shown here for instance.
Check it out and let me know if any issues arise. 

Regards,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Thomas Salt
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or