Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get grid view column values while looping?
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
How to get grid view column values while looping?
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01326177
Message ID:
01326177
Vues:
167
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?

Thanks a lot in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform