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

[Solved] GridHyperLinkColumn & FilterExpression

1 Answer 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Daniel asked on 22 Apr 2009, 10:48 PM
Hi. I'm trying to set a filter expression on a GridHyperLinkColumn in my codebehind. From what I've read, this isn't possible. Here is part of my code:

                fStr = Request.Params["firstName"];
                lStr = Request.Params["lastName"];
                rgPeople.MasterTableView.FilterExpression = "([firstName] LIKE '%" + fStr + "%') ";
                GridHyperLinkColumn column = rgPeople.MasterTableView.GetColumnSafe("firstname");
                column.CurrentFilterFunction = GridKnownFunction.Contains;
                column.CurrentFilterValue = fStr;
                rgPeople.MasterTableView.Rebind();

I understand they are two different types, and casting doesn't work either. It works on GridColumn fine. Is there a work around for this?

Daniel

1 Answer, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
answered on 22 Apr 2009, 11:33 PM
I should really try a bit harder next time before I post! For those of you, that are stuck with this problem, then here is a work around. Simply create a hidden GridBoundColumn with the same attributes as the column you want to sort on. Give it a different UniqueName and set the Display to false. While this isn't ideal, it certainly works. If there is a better way to do this, let me know. Thanks.

Daniel
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or