ComponentOne GridView for ASP.NET WebForms
Working with GridView for ASP.NET Web Forms / Filtering in C1BoundField and C1TemplateField Columns
In This Topic
    Filtering in C1BoundField and C1TemplateField Columns
    In This Topic

    The C1GridView control supports filtering in both C1BoundField and C1TemplateField columns through the following available properties:

    The following code illustrates filtering for C1TemplateField setting ShowFilter and FilterValue in the grid.
    Source View
    Copy Code
        <Columns>
               <cc1:C1TemplateField DataField="ProductName" HeaderText="Product Name" FilterValue="Chai">
                <ItemTemplate>
                        <asp:Label runat="server" Font-Italic="true" ShowFilter=true  ID="lbl1" Text='<%# Bind("ProductName") %>'> </asp:Label>
                </ItemTemplate>
            </cc1:C1TemplateField>      
            <cc1:C1BoundField DataField="QuantityPerUnit" HeaderText="QuantityPerUnit" SortExpression="QuantityPerUnit">
            </cc1:C1BoundField>
            <cc1:C1BoundField DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice">
            </cc1:C1BoundField>
            <cc1:C1BoundField DataField="UnitsInStock" HeaderText="UnitsInStock" SortExpression="UnitsInStock">
            </cc1:C1BoundField>
            <cc1:C1CheckBoxField DataField="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued">
            </cc1:C1CheckBoxField>
        </Columns>
    

    The output for the above code is as shown:

     

    The following code illustrates filtering for C1TemplateField by setting FilterOperator and FilterValue properties.

    Source View
    Copy Code
    <Columns>
            <cc1:C1TemplateField DataField="ProductName" HeaderText="Product Name" FilterOperator="BeginsWith" FilterValue="a">
                <ItemTemplate>
                        <asp:Label runat="server" Font-Italic="true" ID="lbl1" Text='<%# Bind("ProductName") %>'> </asp:Label>
                </ItemTemplate>
            </cc1:C1TemplateField>     
    </Columns>
    

    The output for the above code is as shown: