Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get grid view column values while looping?
Message
De
23/06/2008 15:05:47
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01326177
Message ID:
01326185
Vues:
26
>Hi everybody,
>
>I'm trying to figure out a syntax to get column values in a GridView while iterating through its rows.
>
>Here is what I'm trying unsuccessfully:
>
>
>  GridViewRow row = null;
>            for (int i = 0; i < this.ProfilesGrid.Rows.Count; i++ )
>            {
>                row = this.ProfilesGrid.Rows[i];
>                CheckBox chkbtnApproved = row.FindControl("chkApproved") as CheckBox ;
>
>                if (chkbtnApproved != null)
>                {
>                    if (chkbtnApproved.Checked == true)
>                    {
>                        int RegID = (int)this.ProfilesGrid.DataKeys[i].Value ;
>
>                        PersonName = row.DataItem["FirstName"].ToString() + " " + row.DataItem["LastName"].ToString(); // Here is an error Error	113	Cannot apply indexing with [] to an expression of type 'object'	
>
>
>How can I construct Person Name in a loop?



My guess is that you simply use row["LastName"].....etc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform