RadGrid Filter not working

3 posts, 0 answers
  1. prasadsa01
    prasadsa01 avatar
    5 posts
    Member since:
    Sep 2018

    Posted 14 Sep 2018 Link to this post

    I have two filter columns in my grid; however, only one filter (Status) is working. The second filter (Classification) is not working ( alone or in combination with first). I followed Demo example from https://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/filter-templates/defaultvb.aspx

     

     <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" Width="100%"   AllowFilteringByColumn="True"
                AllowSorting="True" AllowPaging="True" PageSize="7" runat="server" AutoGenerateColumns="False"
                ShowStatusBar="true" EnableLinqExpressions="false">
                <MasterTableView DataKeyNames="InstitutionID" TableLayout="Fixed">
                    <Columns>
                        <telerik:GridBoundColumn UniqueName="InstitutionID" DataField="InstitutionID" HeaderText="Institution ID"
                            AllowFiltering="false" HeaderStyle-Width="200px" />
                         
                       <telerik:GridBoundColumn UniqueName="PrgOffStatus" DataField="PrgOffStatus" HeaderText="Status" HeaderStyle-Width="200px">
                            <FilterTemplate>
                                <telerik:RadComboBox RenderMode="Lightweight" ID="RadComboBoxCity"   
                                      Width="100px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("PrgOffStatus").CurrentFilterValue %>'
                                    runat="server" OnClientSelectedIndexChanged="CityIndexChanged">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="All" />
    <telerik:RadComboBoxItem Text="Active" Value="Active" />
                                                <telerik:RadComboBoxItem Text="Discontinued" Value="Discontinued" />
                                                <telerik:RadComboBoxItem Text="Suspended" Value="Suspended" />   
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                                    <script type="text/javascript">
                                        function CityIndexChanged(sender, args) {
                                            var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");
    tableView.filter("PrgOffStatus", args.get_item().get_value(), "EqualTo");
                                    }
                                    </script>
                                </telerik:RadScriptBlock>
                            </FilterTemplate>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ProgramClass" HeaderText="Classification" UniqueName="ProgramClass"
                            HeaderStyle-Width="200px" >
                            <FilterTemplate>
                                <telerik:RadComboBox RenderMode="Lightweight" ID="RadComboBoxCountry"    
                                     Width="100px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("ProgramClass").CurrentFilterValue %>'
                                    runat="server" OnClientSelectedIndexChanged="CountryIndexChanged">
                                    <Items>
                                         <telerik:RadComboBoxItem Text="All" Value="" />
                                               <telerik:RadComboBoxItem Text="Program" Value="Program" />
                                                <telerik:RadComboBoxItem Text="Concentration" Value="Concentration" />
                                                <telerik:RadComboBoxItem Text="Certificate" Value="Certificate" /> 
                <telerik:RadComboBoxItem Text="NoAward" Value="NoAward" />
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
                                    <script type="text/javascript">
                                        function CountryIndexChanged(sender, args) {
                                            var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");
    tableView.filter("ProgramClass", args.get_item().get_value(), "EqualTo");
                                    }
                                    </script>
                                </telerik:RadScriptBlock>
                            </FilterTemplate>
                             
                        </telerik:GridBoundColumn>
                      
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>

     

     

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4848 posts

    Posted 18 Sep 2018 Link to this post

    Hello,

    The code seems fine and there is nothing obviously wrong with it. Can you confirm there are no errors thrown and that the data in the column is strings that can be compared against the current string? Also, can you confirm you are providing the same data source to the grid every time: https://www.telerik.com/support/kb/aspnet-ajax/grid/details/how-to-bind-radgrid-properly-on-server-side? I am also attaching below an example I built on top of the provided code that seems to work fine for me. You can use it as for a comparison against the problematic code to find the origin of the problem. If you are still unable to resolve it, I would recommend opening a support ticket so you can send us a runnable example that reproduces the grid issue so we can investigate.


    Regards,
    Marin Bratanov
    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.
  3. prasadsa01
    prasadsa01 avatar
    5 posts
    Member since:
    Sep 2018

    Posted 18 Sep 2018 in reply to Marin Bratanov Link to this post

    Thanks Marin!

     

    I will go through the given example and will let you know.

Back to Top