This is a migrated thread and some comments may be shown as answers.

How to search in listview

1 Answer 182 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Hector
Top achievements
Rank 1
Hector asked on 23 May 2015, 01:32 PM
Hello people

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

Example img.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 25 May 2015, 01:41 PM
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
Tags
ListView
Asked by
Hector
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or