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

Sticky Filters

2 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric Klein
Top achievements
Rank 1
Eric Klein asked on 08 Sep 2011, 09:21 PM
I am not sure is this is possible or not in the radgrid, but I have a grid and in the grid I have some basic filtering and also have some fileter templates that use a radcombocox to filter by.  Everything works fine but the users want it setup so that when you filter the grid and then navagate away from the page that when you come back to the page it will load with the last filters already set in the grid. 

When I have done this before I have set the filter up so that it is all done outside the grid and alters the dataset.  Was wondreing if I can do it withing the grid.

This is one of the filters on the grid
<telerik:GridBoundColumn SortExpression="ClientName" DataField="ClientName" HeaderText="Client Name">
      <FilterTemplate>
          <telerik:RadComboBox ID="RadComboBoxClientName" DataTextField="ClientName" DataValueField="ClientName" AppendDataBoundItems="true" Width="150px" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ClientName").CurrentFilterValue %>' runat="server" OnClientSelectedIndexChanged="ClientNameIndexChanged" Skin="Office2007">
           </telerik:RadComboBox>
      <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
          <script type="text/javascript">
                   function ClientNameIndexChanged(sender, args) {
                       var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                       if (args.get_item().get_value() == "0") {
                            tableView.filter("ClientName", args.get_item().get_value(), "NoFilter");
                        }
                       else {
                            tableView.filter("ClientName", args.get_item().get_value(), "EqualTo");
                       }
             }
            </script>
       </telerik:RadScriptBlock>
   </FilterTemplate>
   <ItemStyle VerticalAlign="Top" />
</telerik:GridBoundColumn>

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 13 Sep 2011, 09:07 AM
Hello Eric Klein,

I think that this online example will help you achieve your goal:
Persisting Grid Settings 

Refer to the part which saves and restores the filter expression value inside GridSettingsPersister.cs file.

Kind regards,
Pavlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Eric Klein
Top achievements
Rank 1
answered on 13 Sep 2011, 08:35 PM
Ok thanks.
Tags
Grid
Asked by
Eric Klein
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Eric Klein
Top achievements
Rank 1
Share this question
or