New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Accessing Expression Items

Accessing Items

RadFilter exposes the ExpressionItemCreated event which is fired after each item creation.It provides a more easy and intuitive way of accessing the filter expression items. Depending on expressionthat was created the item in the arguments could be either RadFilterSingleExpressionItem or RadFilterGroupExpression.

Below is a sample code implementation which demonstrates how you can manipulate the filter items. The code logic forbids the creation of sub-group expressions by hiding the AddGroupExpressionButton and populates the RadFilterDropDownEditor with data.

ASPNET
<div class="filterDiv">
    <telerik:RadFilter RenderMode="Lightweight" runat="server" ID="RadFilter1" FilterContainerID="RadGrid1" ShowApplyButton="true" 
        OnExpressionItemCreated="RadFilter1_ExpressionItemCreated">
        <FieldEditors>
            <telerik:RadFilterDropDownEditor FieldName="ShipCountry" DataTextField="ShipCountry"
                DataValueField="ShipCountry" />
        </FieldEditors>
    </telerik:RadFilter>
</div>
<telerik:RadGrid RenderMode="Lightweight" runat="server" ID="RadGrid1" AutoGenerateColumns="false" DataSourceID="SqlDataSource1"
    AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true">
    <MasterTableView IsFilterItemExpanded="false" CommandItemDisplay="Top">
        <Columns>
            <telerik:GridNumericColumn DataField="OrderID" HeaderText="OrderID" DataType="System.Int32">
            </telerik:GridNumericColumn>
            <telerik:GridDateTimeColumn DataField="OrderDate" HeaderText="OrderDate" DataFormatString="{0:MM/dd/yyyy}">
            </telerik:GridDateTimeColumn>
            <telerik:GridNumericColumn DataField="ShipVia" HeaderText="ShipVia" DataType="System.Int32">
            </telerik:GridNumericColumn>
            <telerik:GridBoundColumn DataField="ShipName" HeaderText="ShipName">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ShipAddress" HeaderText="ShipAddress">
            </telerik:GridBoundColumn>
            <telerik:GridNumericColumn DataField="Freight" HeaderText="Freight" DataType="System.Decimal">
            </telerik:GridNumericColumn>
            <telerik:GridNumericColumn DataField="ShipCountry" HeaderText="ShipCountry">
            </telerik:GridNumericColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    SelectCommand="Select OrderID, OrderDate, ShipVia, ShipName, ShipAddress, Freight, ShipCountry FROM Orders">
</asp:SqlDataSource>

In the tables below are listed the properties of the expression items according to the type.

RadFilterExpressionItem

PropertyDescription
FunctionalInterfaceContainerGets the container holding the links menu - the GroupOperation(for RadFilterGroupExpressionItem), FilterFunction and the editor FieldName.
ToolsInterfaceContainerGets the container holding item specific controls. An input control for the RadFilterSingleExpressionItem and AddGroupExpression, AddItemExpression for the RadFilterGroupExpressionItem.
RemoveButtonGets a reference to the remove button which removes an expression from the RadFilter expression tree.

RadFilterGroupExpressionItem

PropertyDescription
GroupOperationChooserLinkGets the HyperLink control which chooses the item expression GroupOperation value
AddExpressionButtonGets the LinkButton control which adds a new RadFilterSingleExpressionItem to the RadFilter expression items tree
AddGroupExpressionButtonGets the LinkButton control which adds a new RadFilterGroupExpressionItem to the RadFilter expression items tree

RadFilterSingleExpressionItem

PropertyDescription
FieldNameGets the associated RadFilterNonGroupExpression.FieldName value
IsSingleValueGets a value indicating if the expression item have only one value. If the property returns true the InputControl value will not be null
IsDoubleValueGets a value indicating if the expression item have two values (between filtering is performed). If the property returns true the SecondInputControl value will not be null
InputControlThe input control which determines an expression value. The property could return null if the Expression is not of type IRadFilterValueExpression
SecondInputControlThe second input control which determines the second expression value when performing between filtering. The property will not return null only when performing between filtering
FieldNameChooserLinkGets the HyperLink control which is used for choosing the FieldName
FilterFunctionChooserLinkGets the HyperLink control which is used for choosing the FilterFunction
BetweenDelimeterGets the LiteralControl which is placed between the two input controls when the filter function is "Between" or "NotBetween"
In this article
Accessing Items
Not finding the help you need?
Contact Support