My table contains records from 2001 til 2012. How can I effectively setup defaults so that initially only records from say 2011-2012 are shown ? I have set the startdate control to 01-01-2011 but of course the date range values are only added to the filterexpression when a user selects a different date value.
4 Answers, 1 is accepted
Thank you for contacting us.
You could apply filtering on initial page load as shown below:
An alternative approach would be the following:
Please note that in spite of "EqualTo", you will need to use "Between" filter function according to your specific scenario. Please refer to the topic below for additional details on filter expressions:
Operating with the FilterExpression of Telerik RadGrid Manually
Additionally, you could check out the following demo which demonstrates how to preserve the text in a Filter Template with two date pickers:
Grid / Filter Templates
I hope this will prove helpful.
the Telerik team
Thanks, I will try your suggestion.
In the meantime I have a different -strange- problem.
I customized the filtertemplate example and included the daterange filter, which works fine.
That is: if I compile and run the project inside VS, using the buildin localhost webserver.
Now when I publish the precompiled website to our local intranet, the daterange filter does not filter anything, all records are displayed, and the loading panel forever keeps on showing the rotating cursor...... Any suggestion where to search for this problem ?
Your suggestion works, but only on the initial pageload.
As soon as we select a value from one of the dropdownlists of other filtercolumns the default filtercondition for our daterange filter is ignored.
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
RadGrid1.MasterTableView.FilterExpression = "(([T$QDAT] >= '01/01/2011') AND ([T$QDAT] <= '31/12/2015'))"
Protected Sub RadGrid1_PreRender(ByVal source As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender
If (Not IsPostBack And RadGrid1.Items.Count = 0) Then
RadGrid1.MasterTableView.FilterExpression = String.Empty
In order to preserve the filtered value, please try the following:
As demonstrated in the demo below:
Applying Default Filter on Initial Load
That should solve the issue.
the Telerik team