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

RadGrid Filtermenu Customisation

0 Answers 12 Views
This is a migrated thread and some comments may be shown as answers.
Johan
Top achievements
Rank 1
Johan asked on 03 Jan 2018, 02:02 PM

Hello,

so im trying to add a button to the first cell in the Filtermenu with a 'Clear all filters' functionality. However i cant seem to get a handle on the first cell.

Here's some testing that i've tried so far with various examples i've found over the internet.

Private Sub Grid_OnItemCreated(sender As Object, e As GridItemEventArgs)
            If e.Item.ItemType = GridItemType.FilteringItem Then
                Dim clearFilterButton = New RadButton() With {.ButtonType = RadButtonType.StandardButton,
                                                              .Height = 22,
                                                              .Width = 22,
                                                              .Text = "Clear Filter",
                                                              .ToolTip = "Clear all filters"}
 
                AddHandler clearFilterButton.Click, AddressOf ClearFilterButton_Click
                Dim grid As RadGrid = CType(sender, RadGrid)
 
                Dim firstcell = grid.Controls(0)
                firstcell.Controls.Add(clearFilterButton)
            End If
        End Sub
 
        Private Sub ClearFilterButton_Click(sender As Object, e As EventArgs)
            For Each grid As RadGrid In Controls.All().OfType(Of RadGrid)()
                grid.MasterTableView.FilterExpression = String.Empty
                grid.Rebind()
            Next
        End Sub

 

I cant seem to get it to do anything at all tho. Even just trying to hide the Filtermenu does not seem to do anything. And yes the event is firing, it is triggered in the basepage load. Is this the way to add a button to a filtermenu? Or is there a better way?

Regards

 

 

 

 

 

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Johan
Top achievements
Rank 1
Share this question
or