New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Save filter expression text
Environment
Product | RadFilter for ASP.NET AJAX |
Description
Sometimes, one might want to save the filter expressions (the text that comes from the filter after the ExpressionPreviewPosition property has been set) for a specific use.
Solution
You can save the filter expression by using the ItemCommand event and getting the corresponding FieldName, FilterExpression, and Value properties.
ASP.NET
<telerik:radfilter runat="server" id="RadFilter1" filtercontainerid="RadGrid1"
expressionpreviewposition="Bottom" onitemcommand="RadFilter1_ItemCommand" />
<asp:Label Text="" ID="Label1" runat="server" />
<telerik:radgrid runat="server" id="RadGrid1" autogeneratecolumns="false" width="600px" allowpaging="true" allowsorting="true" datasourceid="SqlDataSource1">
<mastertableview>
<columns>
<telerik:gridboundcolumn datafield="OrderID" headertext="OrderID" datatype="System.Int32" />
<telerik:gridboundcolumn datafield="ShipCity" headertext="ShipCity" />
<telerik:gridboundcolumn datafield="ShipName" headertext="ShipName" />
</columns>
</mastertableview>
</telerik:radgrid>
<asp:SqlDataSource runat="server" ID="SqlDataSource1"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="Select OrderID, ShipName, ShipCity FROM Orders"></asp:SqlDataSource>