Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ListView in Virtual mode
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01507445
Message ID:
01507578
Vues:
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();
>
>Hi Viv, thanks for that , what I need is the index of the ListViewItem - but I can get it from the item - thanks again
int index = (int)(from ListViewItem lvi in MyList where lvi.Text == e.Text select lvi.Index).FirstOrDefault();
(will be 0 if not found)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform