Default Filter on Initial Load for GridDateTimeColumn with RangeFiltering

5 posts, 1 answers
  1. Morgan
    Morgan avatar
    3 posts
    Member since:
    Jul 2012

    Posted 29 Jun 2012 Link to this post

    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
  2. Answer
    Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 04 Jul 2012 Link to this post

    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.
  3. Zaher
    Zaher avatar
    5 posts
    Member since:
    Jan 2012

    Posted 30 Oct 2013 Link to this post

    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)?
  4. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 04 Nov 2013 Link to this post

    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.
  5. Madhavi
    Madhavi avatar
    4 posts
    Member since:
    Oct 2015

    Posted 23 Oct 2017 Link to this post

    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>

Back to Top