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

RadGrid Filter not working

2 Answers 821 Views
Filter
This is a migrated thread and some comments may be shown as answers.
prasadsa01
Top achievements
Rank 1
prasadsa01 asked on 14 Sep 2018, 06:13 PM

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 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 18 Sep 2018, 11:19 AM
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.
0
prasadsa01
Top achievements
Rank 1
answered on 18 Sep 2018, 01:11 PM

Thanks !

 

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

Tags
Filter
Asked by
prasadsa01
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
prasadsa01
Top achievements
Rank 1
Share this question
or