Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Another ListView problem
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Another ListView problem
Divers
Thread ID:
01182698
Message ID:
01182698
Vues:
69
Hi All, I'm having a problem retrieving subitems from a listview using the string indexer method, my code for filling the lv is as shown below
// take it as read there is data in the dataset.
 foreach (DataRow dr in this.dsArt39Benefics.Tables[0].Rows)
 {
    lvi = new ListViewItem(dr["BenName"].ToString());
    lvi.SubItems.Add(dr["Ben_AddrLine1"].ToString());
    lvi.SubItems.Add(dr["Ben_AddrLine2"].ToString());
    lvi.SubItems.Add(dr["Ben_AddrLine3"].ToString());
    lvi.SubItems.Add(dr["Ben_AddrLine4"].ToString());
    lvi.SubItems.Add(dr["CreateDate"].ToString());
    lvi.SubItems.Add(dr["CreateUser"].ToString());
    lvi.SubItems.Add(dr["AmendDate"].ToString());
    lvi.SubItems.Add(dr["AmendUser"].ToString());
             
    this.lvBeneficialOwnersNameAddress.Items.Add(lvi);

}
Later in the code I try to retrieve a value like this
ListViewItem lvi = this.lvBeneficialOwnersNameAddress.SelectedItems[0];

string s = lvi.SubItems["AmendUser"].Text;
the string s is always null, however, if I do it this way (the code below) it works, anyone know why ?
ListViewItem lvi = this.lvBeneficialOwnersNameAddress.SelectedItems[0];

string s = lvi.SubItems[8].Text;
Regards,
Peter J. Kane



Pete
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform