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

Clear filters routine and radDatePicker

1 Answer 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 28 Sep 2012, 06:45 PM
I'm using the Clear_filters routine that was posted elsewhere on the Telerik site.  It works fine and DOES reset the Grid by removing any filters, including the dates from the radDatePicker, however, it doesn't change the display date on the Calendar back to the Default date?

The below doesn't work.
Protected Sub Clearfilters_Click(sender As Object, e As System.EventArgs) Handles Clearfilters.Click
       RiskAssessmentsGrid.MasterTableView.FilterExpression = String.Empty
 
       For Each column As GridColumn In RiskAssessmentsGrid.MasterTableView.RenderColumns
           If TypeOf column Is GridBoundColumn Then
               Dim boundColumn As GridBoundColumn = TryCast(column, GridBoundColumn)
               boundColumn.CurrentFilterValue = String.Empty
           End If
       Next
 
 
       For Each item As GridFilteringItem In RiskAssessmentsGrid.MasterTableView.GetItems(GridItemType.FilteringItem)
 
           Dim f As RadDatePicker = DirectCast(item.FindControl("FromDateCreatedPicker"), RadDatePicker)
           Dim t As RadDatePicker = DirectCast(item.FindControl("ToDateCreatedPicker"), RadDatePicker)
 
           f.SelectedDate = DateTime.Now.Date
           t.SelectedDate = DateTime.Now.Date
 
       Next
 
       RiskAssessmentsGrid.MasterTableView.Rebind()
       RiskAssessmentsGrid.Rebind()
 
   End Sub

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 04 Oct 2012, 08:15 AM
Hello Tim,

You can use the ClearFilter command as demonstrated below:
Protected Sub Clearfilters_Click(sender As Object, e As System.EventArgs) Handles Clearfilters.Click
    Dim filteringItem = CType(RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)(0), GridFilteringItem)
    filteringItem.FireCommandEvent("ClearFilter", "")
End Sub

Best 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.
Tags
Grid
Asked by
Tim
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or