RadGrid filters not working on multiple columns

7 posts, 0 answers
  1. Lokesh
    Lokesh avatar
    2 posts
    Member since:
    Jun 2016

    Posted 08 Jun 2016 Link to this post

    I am using radgird and allowing filters on all columns. I have 3 columns on grid and I am binding those columns dynamically using vb.net code behind.
    On UI page I have only the below script:

    <telerik:RadGrid ID="gridData" runat="server" Visible="true" RenderMode="Native"> </telerik:RadGrid>

    The problem is that when I apply filter on one column that is worked fine now simultaneously I apply filter on second column then it removes the filter of first column. Please see the attached screenshot.

    In code behind I have grid event like:
    Protected Sub gridData_NeedDataSource(ByVal Source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles gridData.NeedDataSource

    but this event is also not firing in any case.

    Any idea about filtering on multiple columns issue?

  2. Eyup
    Admin
    Eyup avatar
    3647 posts

    Posted 13 Jun 2016 Link to this post

    Hi Lokesh,

    In the documentation it is stated:
    "As many of the controls, especially RadGrid, are complex controls which do not have such specific HTML element equivalents, the Native render mode is not supported or have the same effect as Classic."

    You can check the full explanation here:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/mobile-support/render-modes

    Please change the RenderMode of the grid and let me know if it resolves the issue.Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:

    Declarative DataSource (DataSourceID property)
    Programmatic Data Binding (NeedDataSource event, + DetailTableDataBind for hierarchy). You should set the DataSource property ONLY within these event handler.

    Also, temporarily disable any AJAX on the page if present (RadAjaxManager, RadAjaxPanel, UpdatePanel, etc.) and enable your script debugger (FireBug or F12) to see whether there are any script or server errors interfering.



    Regards,
    Eyup
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. Kiranmayee
    Kiranmayee avatar
    22 posts
    Member since:
    Jul 2018

    Posted 23 Aug 2018 Link to this post

    Filtering in radgrid does not work when sysid is the first column and sysdttm is the second column. It works when I swap them. I made sysdttm first column and sysid as the second column it works. The code below works. I was wondering why it doesn't work other way around. 

     

    Thank you.

     

    ASPX:

     <telerik:RadGrid ID="rgInbq" AllowAutomaticUpdates="false" AutoGenerateColumns="false" AllowSorting="TRUE" ShowHeaderWhenEmpty="true" EnableEmbeddedskins="True" GridLines="None" 
                            runat="server" Skin="Black" ShowFooter="True" Width="100%"  AllowPaging="True" pagesize ="50" AllowFilteringByColumn="True"  EnableLinqExpressions="false"
                     OnNeedDataSource="rgInbq_NeedDataSource"  >
                     <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Black">
                        </HeaderContextMenu>
                     <ClientSettings AllowColumnsReorder="True"  EnableRowHoverStyle="True"  >
                            <Scrolling  UseStaticHeaders="True"   ScrollHeight="600px" AllowScroll="true"></Scrolling>                      
                            <Selecting AllowRowSelect="True" />
                         </ClientSettings>
                      <MasterTableView DataKeyNames="SYS_ID, STATUS, TRAILER_ID, LOC_ID" AutoGenerateColumns="False"  >
                        <EditFormSettings>
                            <EditColumn CancelImageUrl="Cancel.gif" EditImageUrl="Edit.gif" InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif">
                            </EditColumn>
                        </EditFormSettings>
                          
                        <Columns>          
                            
                            <telerik:GridBoundColumn DataField="SYS_DT_TM"  HeaderText="IB DATE TIME" ReadOnly="true" SortExpression="SYS_DT_TM" UniqueName="SYS_DT_TM"  AllowFiltering="false" >
                                        <HeaderStyle Font-Size="8pt" width="20px"/>
                                        <ItemStyle Font-Size="10pt"  HorizontalAlign="LEFT"  />
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn DataField="SYS_ID"  HeaderText="INBQ REF" ReadOnly="true" SortExpression="SYS_ID" UniqueName="SYS_ID"  AllowFiltering="true"  AutoPostBackOnFilter="true" ShowFilterIcon="false" FilterControlWidth="70px" Aggregate="Count" CurrentFilterFunction="Contains" >
                                        <HeaderStyle Font-Size="8pt"  Width="20px"/>
                                        <ItemStyle Font-Size="10pt"  HorizontalAlign="LEFT"/>
                            </telerik:GridBoundColumn>                        

                            <telerik:GridBoundColumn DataField="USER_ID"  HeaderText="USER ID" ReadOnly="true" SortExpression="USER_ID" UniqueName="USER_ID"  AllowFiltering="false" >
                                        <HeaderStyle Font-Size="8pt" width="10px"/>
                                        <ItemStyle Font-Size="10pt"  HorizontalAlign="LEFT"  />
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn DataField="LOC_ID" HeaderText="LOC ID" ReadOnly="true" SortExpression="LOC_ID" UniqueName="LOC_ID" AllowFiltering="false" >
                                        <HeaderStyle Font-Size="8pt" Width="10px" />
                                        <ItemStyle Font-Size="10pt"  HorizontalAlign="LEFT"  />
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn DataField="TRAILER_ID" HeaderText="TRAILER ID" ReadOnly="true" SortExpression="TRAILER_ID" UniqueName="TRAILER_ID" AllowFiltering="true" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"  ShowFilterIcon="false" FilterControlWidth="100px">
                                        <HeaderStyle Font-Size="8pt" Width="20px" />
                                        <ItemStyle Font-Size="10pt"  HorizontalAlign="LEFT"  />
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn DataField="STATUS" HeaderText="STATUS" ReadOnly="true" SortExpression="STATUS" UniqueName="STATUS"  AllowFiltering="false" >
                                        <HeaderStyle Font-Size="8pt" Width="10px" />
                                        <ItemStyle Font-Size="10pt"  HorizontalAlign="LEFT"  />
                            </telerik:GridBoundColumn>

                            <telerik:GridTemplateColumn UniqueName="UPDATE" HeaderText="UPDATE STATUS TO SUS" Visible="TRUE" AllowFiltering="false">
                                        <ItemTemplate>
                                             <asp:imageButton ButtonType="ImageButton" ID="btnUpdate" runat="server" CommandName="UPDATE" ImageUrl="images/Update.gif" OnClientClick="return confirm('Are you certain you want to UPDATE the status to SUS?');"
                                                Text="Update"  />
                                         </ItemTemplate>
                                        <HeaderStyle ForeColor="WHITE" HorizontalAlign="left" Width="100px" />
                                        <ItemStyle /> 
                            </telerik:GridTemplateColumn>

                        </Columns>
                     
                    </MasterTableView>            
                  </telerik:RadGrid>

  4. Eyup
    Admin
    Eyup avatar
    3647 posts

    Posted 28 Aug 2018 Link to this post

    Hello Kiranmayee,

    The filtering of the SYS_ID column should work in both of the cases, while the filtering of the SYS_DT_TM column will work if you enable its AllowFiltering property. You can also check your rgInbq_NeedDataSource logic in the code-behind and ensure that it does not include DataBind or Rebind methods inside:
    https://www.telerik.com/support/kb/aspnet-ajax/grid/details/how-to-bind-radgrid-properly-on-server-side

    If the issue remains, please open a formal support thread and send us a very basic isolated runnable web site to demonstrate the issue for further investigation.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Kiranmayee
    Kiranmayee avatar
    22 posts
    Member since:
    Jul 2018

    Posted 28 Aug 2018 in reply to Eyup Link to this post

    I don't want the filtering on the sys dt tm column. Filtering the sys id column is needed though. I don't know why now the filtering doesn't work if sys id is placed in the first column or the second column. There is no data bind or rebind in the need data source. :\

     

     Protected Sub rgInbq_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles rgInbq.NeedDataSource
            Dim ds As DataSet
            Dim MyCommand As SqlDataAdapter
            Dim nRecCount As Integer
            Dim dt As DataTable

            'CheckSystem()
            'strUserID = Session("USERID")

            strSQlData = "SELECT SYS_ID, SYS_DT_TM, USER_ID, LOC_ID, TRAILER_ID, STATUS FROM INBOUND_Q WHERE STATUS = 'WIP'"

            MyCommand = New SqlDataAdapter(strSQlData, oConn)
            ds = New DataSet
            MyCommand.Fill(ds, "INFO")

            'Assign Values For text fields
            dt = ds.Tables(0)

            Dim Source As DataView = ds.Tables("INFO").DefaultView

            If dt.Rows.Count > 0 Then       ' Verify If a Contact Exists

                nRecCount = dt.Rows.Count

                rgInbq.DataSource = Source
                'rgInbq.DataBind()
                rgInbq.Visible = True

                oConn.Close()
            Else
                rgInbq.DataSource = Source
                'rgInbq.DataBind()
                rgInbq.Visible = True

                oConn.Close()
            End If
        End Sub

  6. Kiranmayee
    Kiranmayee avatar
    22 posts
    Member since:
    Jul 2018

    Posted 28 Aug 2018 Link to this post

    This is weird. I works sometimes and it doesnt work sometimes. I do not know what causes this issue. I placed a refresh button as there can more records that suits the radgrid. I thought may be it works properly after refreshing the page but no. I am still not able to figure out what's causing the filter to break.
  7. Eyup
    Admin
    Eyup avatar
    3647 posts

    Posted 31 Aug 2018 Link to this post

    Hi Kiranmayee,

    In this case, it would be better if we reproduce the issue locally on our side in order to further debug it. Please open an official support ticket and modify the attached web site sample to demonstrate the issue and send it back to us.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top