How to search in listview

2 posts, 1 answers
  1. Hector
    Hector avatar
    7 posts
    Member since:
    Apr 2015

    Posted 23 May 2015 Link to this post

    Hello people

    How to search in listview using textbox and button, and used the propiertied focused.

    Example img.
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 25 May 2015 Link to this post

    Hi Hector,

    Thank you for writing back.

    Before getting to your question I want to remind you that the requested license information is still not provided (see thread: Formatting GridView Columns for WinForms). I am reminding you this because most of the forum threads are reviewed by Telerik representative and we address the questions asked by our customers in the forums as well. For users with no valid licenses like yourself we use the opportunity to kindly remind you that we will no longer be able to address your questions unless you provide us with a valid license, as it is our company policy is to support only users in good account standing. 

    I have moved your Forum post to our support ticketing system (which is private communication channel) to avoid sharing confidential information in the public Forums. You can find the ticket in Your Telerik Account.

    As to the question at hand, you can iterate all cells and check their values:
    private void radButton1_Click(object sender, EventArgs e)
    {
        foreach (ListViewDataItem row in radListView1.Items)
        {
            for (int i = 0; i < row.FieldCount; i++)
            {
                if (row[i].ToString() == searchedText)
                {
                    Console.WriteLine("Found");
                    radListView1.SelectedItem = row;
                    radListView1.CurrentColumn = radListView1.Columns[i];
                }
            }
        }
    }

    I hope this helps.

    Regards,
    Dimitar
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top