ComponentOne ListView for ASP.NET Web Forms
Task-Based Help / Using the Filter and Search Functions / Setting the Filter Function
In This Topic
    Setting the Filter Function
    In This Topic

    Setting up your C1ListView control to allow searching and filtering is easy. Complete these steps:

    1. Create a C1ListView which will display a list of data that you want to be able to filter. Use markup like the following:
      
      <cc1:C1ListView ID="C1ListView1" runat="server">
      <Items>
      <cc1:C1ListViewLinkItem Text="The Godfather"></cc1:C1ListViewLinkItem>
      <cc1:C1ListViewLinkItem Text="The Good, the Bad and the Ugly"></cc1:C1ListViewLinkItem>
      <cc1:C1ListViewLinkItem Text="12 Angry Men"></cc1:C1ListViewLinkItem>
      <cc1:C1ListViewLinkItem Text="One Flew Over the Cuckoo's Nest"></cc1:C1ListViewLinkItem>
      <cc1:C1ListViewLinkItem Text="Star Wars: Episode V - The Empire Strikes Back"></cc1:C1ListViewLinkItem>
      <cc1:C1ListViewLinkItem Text="The Dark Knight"></cc1:C1ListViewLinkItem>
      </Items>
      </cc1:C1ListView>
    2. Set the Filter property to "true" as in the following markup:
      <cc1:C1ListView ID="C1ListView1" runat="server" Filter="true">
    3. You can also set the placeholder text for the search box that is appended to the C1ListView list when you set the Filter property to "true":
      <cc1:C1ListView ID="C1ListView1" runat="server" Filter="true" FilterPlaceholder="Find a movie...">
    4. Press F5 or start debugging to run your application. It should appear as in the following image:

      If you begin typing in the search bar, the results will be filtered:

    See Also