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

Default Filter on Initial Load for GridDateTimeColumn with RangeFiltering

4 Answers 224 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Morgan
Top achievements
Rank 1
Morgan asked on 29 Jun 2012, 04:03 PM

Is the a standard way of setting the default filter in the vb code-behind for a GridDateTimeColumn that has RangeFiltering?  

My problem is not with making the initial FilterExpression string, but rather how to set the boxes so that if someone filters by a different value without manually setting the dateTimePicker, the values will still be picked up for the FilterExpression.

I have thought up alternate solutions to this problem like storing my starting value. Because of some rarities in my code, I view and edit my FilterExpression every time  a filter is called, therefore when a filter is changed I can see if the FilterExpression contains the GridDatePickerColumnFilter filtering information and if it does not (meaning that nobody has manually changed the dateTimePicker fields) then i can re-add it myself from the labels (or recalculate it again). 

Unfortunately this requires alot of additional code and paying close attention. I would be really appreciative if someone knows if there is a way to set the dateTimePicker similar to how "column.CurrentFilterValue = [string]" will set the filter textbox so that the next time a filter is called or the table is rebound, it still remember the filter value.

Thanks, 
Morgan

4 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 04 Jul 2012, 02:03 PM
Hi Morgan,

I believe you should be able to use the CurrentFilterValue property of the column. You could set both dates separated by a whitespace character like shown below:
RadGrid1.MasterTableView.GetColumn("date").CurrentFilterValue = "7/11/2012 7/12/2012"

Let me know if I'm missing something.

Regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Zaher
Top achievements
Rank 1
answered on 30 Oct 2013, 02:51 PM
If you EnableRangeFiltering="true" (on the GridDateTimeColumn), there are 2 values that can be set, yes? How would I set the "To:" filter value specifically (and include a time)?
0
Daniel
Telerik team
answered on 04 Nov 2013, 12:19 PM
Hello Zaher,

If I'm not missing something you'd like to set only the second date/time. Depending on whether there is a value in the field you can just replace the second one using string operations. If there is no current value you can set the first date/time to the min date/time possible.

Regards,
Daniel
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Madhavi
Top achievements
Rank 1
answered on 23 Oct 2017, 09:25 AM

How to set current date to the 'To' Date of GridDateTimeColumn. and Filteration is using 'Between'. I want Auto filter after selecting 'From' date and 'To' date is current date. Please help,how to do. Thank you in advance

 <telerik:GridDateTimeColumn DataField="QuoteDate" HeaderText="Quote Date" UniqueName="QuoteDate"
                        SortExpression="QuoteDate" PickerType="DatePicker" EnableRangeFiltering="true"
                        DataFormatString="{0:MM/dd/yyyy}" AutoPostBackOnFilter="true" DataType="System.DateTime"  ShowFilterIcon="false" >
                       
                    </telerik:GridDateTimeColumn>

Tags
Grid
Asked by
Morgan
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Zaher
Top achievements
Rank 1
Madhavi
Top achievements
Rank 1
Share this question
or