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

Filter DateTime Column like a String

1 Answer 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 03 Jan 2013, 09:57 PM
I have a radgrid that auto generates its columns from a data table. I need to allow the user to enter a value in a textbox and search all columns of the grid for matches. I have the filter working for every column of the table that is pure text. The problem occurs with the date assigned column since it is not pure text but a datetime column.

The current Filter expression is:
WorkPackageGrid.MasterTableView.FilterExpression = "(([Title] LIKE \'%" + OtherFilter.Text + "%\')OR([Number] LIKE \'%" + OtherFilter.Text + "%\')OR([Status] LIKE \'%" + OtherFilter.Text + "%\')OR([ApprovalStatus] LIKE \'" + OtherFilter.Text + "\')OR([ScopeName] LIKE \'%" + OtherFilter.Text + "%\'))"

Is there a way to filter the datetime column based on the cells text value so all i need to add is "OR([DateAssigned] LIKE \'%" + OtherFilter.Text + "%\')" or convert the column to a pure text value so the same line would work?

1 Answer, 1 is accepted

Sort by
0
Matthew
Top achievements
Rank 1
answered on 04 Jan 2013, 02:30 PM
I was able to solve the problem by creating another row in my datasource datatable that was set to the toString() of the original date column. Then I hid the original column during prerender and ran the filter on the string column in case anyone else runs into this problem.
Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Answers by
Matthew
Top achievements
Rank 1
Share this question
or