Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ListView in Virtual mode
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01507445
Message ID:
01507452
Views:
29
>Hi All, I'm looking at using the ListView control in virtual mode - I have managed to populate the list by creating a generic List of type ListViewItem , which I populate from a DataTable, then in the RetrieveVirtualItem eventhandler I set the e.Item property to MyList[e.Index] ( which is passed in the eventargs param ), this all works pretty well. The question I have is, what is the best way to search the ListView for a given string ? When in virtual mode the items collection is not available so you have to manage an event called SearchForVirtualItem which is raised whenever you call FindItemWithText("your text"). What I do at present , is, loop through my generic list and compare its' Text property to the Text property in the eventargs of the eventhandler - this doesn't strike me as very efficient. Any ideas ?

Linq? :
ListViewItem v = (ListViewItem) (from ListViewItem lvi in MyList where lvi.Text == e.Text select lvi).FirstOrDefault();
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform