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

RadGrid FilterType="HeaderContext" does not allow filter

5 Answers 247 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Corey
Top achievements
Rank 1
Corey asked on 18 Feb 2016, 03:21 PM
I can get the menu to show up with the checkboxes for the OnFilterCheckListItemsRequested.

However when you select any of the checkboxes you are not able to click "filter" button and the "show rows with value that" drop down box is disabled.  The button highlights but no click action or postback.

however if i use the "checkbox" or "combine" for the FilterType it works when selecting items from the list.

attached is my radgrid code and a screenshot of the menu.

<telerik:RadGrid ID="RadGrid1" AllowFilteringByColumn="True" runat="server" FilterType="
       AllowPaging="True" OnFilterCheckListItemsRequested="RadGrid1_FilterCheckListItemsRequested"
       Height="100%"  AllowSorting="True"
       ShowGroupPanel="True" EnableGroupsExpandAll="True" EnableHeaderContextMenu="True"
       EnableHierarchyExpandAll="True" ShowFooter="True" ShowStatusBar="True"
       PageSize="500" OnInfrastructureExporting="RadGrid1_InfrastructureExporting"
       EnableHeaderContextAggregatesMenu="True"
       FilterMenu-EnableAutoScroll="False" FilterMenu-EnableImageSprites="True" FilterMenu-EnableRootItemScroll="True"
       FilterMenu-EnableSelection="True" FilterMenu-EnableTextHTMLEncoding="True"
       FilterMenu-ShowToggleHandle="True" MasterTableView-AllowFilteringByColumn="True"
       MasterTableView-EnableGroupsExpandAll="True" MasterTableView-EnableHeaderContextAggregatesMenu="True"
       MasterTableView-EnableHeaderContextFilterMenu="True" MasterTableView-EnableHeaderContextMenu="True"
       MasterTableView-EnableHierarchyExpandAll="True" MasterTableView-RetrieveDataTypeFromFirstItem="True"
       RegisterWithScriptManager="True" PagerStyle-PageSizeControlType="RadComboBox" ClientSettings-AllowColumnHide="True"
       ClientSettings-AllowColumnsReorder="True" ClientSettings-AllowDragToGroup="True"
       ClientSettings-AllowKeyboardNavigation="True" ClientSettings-AllowRowsDragDrop="True"
       ClientSettings-EnableRowHoverStyle="True" FilterMenu-AppendDataBoundItems="True">
        <CommandItemStyle />
        <ExportSettings ExportOnlyData="True" IgnorePaging="True" Excel-Format="Xlsx">
        </ExportSettings>
        <ClientSettings AllowDragToGroup="false" Resizing-AllowColumnResize="true" AllowColumnHide="True"AllowColumnsReorder="True" AllowRowHide="True" AllowRowsDragDrop="True" ReorderColumnsOnClient="True" Animation-AllowColumnReorderAnimation="False" Animation-AllowColumnRevertAnimation="False" DataBinding-EnableCaching="True" Resizing-AllowResizeToFit="True" Resizing-EnableRealTimeResize="True" Scrolling-AllowScroll="False" Scrolling-SaveScrollPosition="True">
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
 
        </ClientSettings>
        <MasterTableView CommandItemDisplay="Top" Width="100%" EnableGroupsExpandAll="True"EnableHeaderContextAggregatesMenu="True">
            <CommandItemSettings ShowAddNewRecordButton="False" ShowExportToCsvButton="True" ShowExportToExcelButton="True"ShowRefreshButton="True" />
        </MasterTableView>
        <FilterMenu CssClass="RadFilterMenu_CheckList">
        </FilterMenu>
    </telerik:RadGrid>

 

 

Code Behind

Protected Sub RadGrid1_FilterCheckListItemsRequested(sender As Object, e As GridFilterCheckListItemsRequestedEventArgs)
    Dim DataField As String = TryCast(e.Column, IGridDataColumn).GetActiveDataField()
 
    e.ListBox.DataSource = GetDataTableFromCacheOrDatabase(DataField)
    e.ListBox.DataKeyField = DataField
    e.ListBox.DataTextField = DataField
    e.ListBox.DataValueField = DataField
    e.ListBox.DataBind()
End Sub
 
 
Private Sub RadGrid1_ColumnCreated(sender As Object, e As GridColumnCreatedEventArgs) Handles RadGrid1.ColumnCreated
 
    e.Column.FilterCheckListEnableLoadOnDemand = True
 
End Sub


5 Answers, 1 is accepted

Sort by
0
Corey
Top achievements
Rank 1
answered on 18 Feb 2016, 03:31 PM
This is for the Excel-Like Filtering Context Menu
0
Viktor Tachev
Telerik team
answered on 22 Feb 2016, 12:51 PM
Hello Corey,

Please set the EnableHeaderContextFilterMenu property for RadGrid to true and see if it makes a difference.

Also, try to define the columns in the markup and check how the behavior changes.


Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Corey
Top achievements
Rank 1
answered on 22 Feb 2016, 01:02 PM
As per my markup i already posted I have EnableHeaderContextFilterMenu set to true.  They Columns are dynamically populated and change so statically setting them is not an option.
0
Corey
Top achievements
Rank 1
answered on 22 Feb 2016, 03:26 PM

Using a new test.aspx page using this code i still get the same issue.

<telerik:RadGrid ID="RadGrid1" AllowFilteringByColumn="True" runat="server" FilterType="HeaderContext"
    AllowPaging="True" OnFilterCheckListItemsRequested="RadGrid1_FilterCheckListItemsRequested"
    DataSourceID="SqlDataSource1" EnableHeaderContextFilterMenu="true">
    <CommandItemStyle />
    <MasterTableView DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="No" EnableHeaderContextMenu="true">
        <Columns>
            <telerik:GridBoundColumn DataField="No"
                FilterControlAltText="Filter No column" HeaderText="No" ReadOnly="True"
                SortExpression="CustomerID" UniqueName="CustomerID">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Customer"
                FilterControlAltText="Filter Customer column" HeaderText="Customer" SortExpression="Customer"
                UniqueName="ContactName">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <FilterMenu CssClass="RadFilterMenu_CheckList">
    </FilterMenu>
</telerik:RadGrid>

 

 

 

Partial Class test
    Inherits System.Web.UI.Page
 
 
    Protected Sub RadGrid1_FilterCheckListItemsRequested(sender As Object, e As GridFilterCheckListItemsRequestedEventArgs)
        Dim DataField As String = TryCast(e.Column, IGridDataColumn).GetActiveDataField()
        e.ListBox.DataSource = GetDataTable(DataField)
        e.ListBox.DataKeyField = DataField
        e.ListBox.DataTextField = DataField
        e.ListBox.DataValueField = DataField
        e.ListBox.DataBind()
    End Sub
 
    Private Sub RadGrid1_DataBound(sender As Object, e As EventArgs) Handles RadGrid1.DataBound
        For Each col As GridColumn In RadGrid1.Columns
            If TypeOf col Is GridBoundColumn Then
                col.FilterCheckListEnableLoadOnDemand = True
                col.AutoPostBackOnFilter = True
                col.HeaderStyle.ForeColor = Color.Red
            End If
            If TypeOf col Is GridTemplateColumn Then
                col.FilterCheckListEnableLoadOnDemand = True
                col.HeaderStyle.ForeColor = Color.Pink
            End If
        Next
    End Sub
 
    Private Sub test_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim strOrig As String = "SELECT username, AD_Name, Last_Login FROM dbo.Live_Reports_Users"
        Dim leftString = strOrig.Substring(strOrig.IndexOf("FROM") + 0)
        Dim SQL_ReWrite = "Select " + "something " + leftString
        Label1.Text = SQL_ReWrite
 
    End Sub
 
    Public Function GetDataTable(field As String) As DataTable
        Dim query As String = String.Format("SELECT     No, Customer FROM         dbo.FiveDayReport", field)
 
        Dim ConnString As [String] = ConfigurationManager.ConnectionStrings("GQTS_BearingQIData").ConnectionString
        Dim conn As New SqlConnection(ConnString)
        Dim adapter As New SqlDataAdapter()
        adapter.SelectCommand = New SqlCommand(query, conn)
 
        Dim myDataTable As New DataTable()
 
        conn.Open()
        Try
            adapter.Fill(myDataTable)
        Finally
            conn.Close()
        End Try
 
        'Return myDataTable
        Dim distinctDT As DataTable = myDataTable.DefaultView.ToTable(True, field)
        Return distinctDT.Select("", field).CopyToDataTable
    End Function
 
End Class

0
Viktor Tachev
Telerik team
answered on 23 Feb 2016, 02:25 PM
Hello Corey,

As discussed in the support ticket we have logged the issue and the developers will investigate what is causing the behavior.

You can monitor the status of the item it our Ideas & Feedback Portal by following the link below.



Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Corey
Top achievements
Rank 1
Answers by
Corey
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or