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

raddatetimepicker in filter template

7 Answers 237 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lee Malo
Top achievements
Rank 1
Lee Malo asked on 01 Feb 2010, 06:02 PM
I found the example for raddatepicker in a filter template for radgrid but it doesn't work for datetimekicker anyone know where I can find a datetimepicker in a filter template example?

7 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 04 Feb 2010, 05:41 PM
Hello Lee Malo,

The implementation of the RadDateTimePicker as a filter control in a "From - To" scenario, using the "Between" filter function requires a little bit different approach, because of the separator that is used between the date and time part of the selected date. The same separator is used as a delimiter of the two values that are applied as a filter criterion when "Between" function is used. That is why the logic depicted in our online demo is not applicable with RadDateTimePicker controls.
To avoid this ambiguity you would need the create the filtering expression on the server. I have attached a small sample project demonstrating this approach.

I hope this helps,
Martin
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Lee Malo
Top achievements
Rank 1
answered on 17 Feb 2010, 12:59 AM
thanks that worked great, however now the other columns will not filter.  Any advice?
0
Lee Malo
Top achievements
Rank 1
answered on 17 Feb 2010, 01:04 AM
all the columns except date are programattically created by the way, I think this makes it difficult
0
Lee Malo
Top achievements
Rank 1
answered on 17 Feb 2010, 02:55 PM
I got it working by manually putting in filtertemplate columns but still not sure how to use if the boundculumns are being created programmatically
0
Martin
Telerik team
answered on 18 Feb 2010, 10:02 AM
Hello Lee Malo,

I have already answered to the support ticket you have opened. Here I am posting my answer for reference to the other members of the community:

"You are correct that the filter command should be canceled only when triggered by the "TimeStamp" column:

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
     if (e.CommandName == RadGrid.FilterCommandName)
     {
          Pair filterPair = (Pair)e.CommandArgument;
          if (filterPair.Second.ToString() == "TimeStamp")
          {
                e.Canceled = true;
                ....
          }
     }
}

Now all other columns (including those added programmatically) should be able to filter the grid.
I have attached a modified version of the sample project that address these changes.

There is an important note here - regularly
RadGrid automatically adds all currently set filter function / value pairs to the GridTableView.FilterExpression property. However when you change the GridTableView.FilterExpression programmatically you would need to manually include all needed filter expressions in order to filter the grid by more than one fields. Otherwise after the grid is rebound it will be filtered only by the "TimeStamp" value set in the MasterTableView.FilterExpression."
 


Regards,
Martin
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.
0
Smiely
Top achievements
Rank 1
answered on 20 Dec 2010, 07:57 PM
This is exact what I am trying to do. So thanks. One concern...

Will it work if DataKeyNames IS NOT MyDate ??? 

As per sample it is
 <MasterTableView DataKeyNames="MyDate">


Please help...
Thanks
0
Smiely
Top achievements
Rank 1
answered on 20 Dec 2010, 11:32 PM
Got it working !!!
Tags
Grid
Asked by
Lee Malo
Top achievements
Rank 1
Answers by
Martin
Telerik team
Lee Malo
Top achievements
Rank 1
Smiely
Top achievements
Rank 1
Share this question
or