Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many rows in a datagrid?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00844332
Message ID:
00844531
Vues:
13
For this case, since my datagrid only shows a single table, I am just going to store the row count of the datasource to the datagrid's tag property at time of binding.

The reason I don't want to look back to the datatable for row counts is because the datatable gets used for other stuff and therefore changes where the datagrid stays static and just serves as a list.
I ended up doing something like this:
// -- Always set the row count to the tag property when binding the grid
this.grdJobs.SetDataBinding(dsJobs,"Jobs");
this.grdJobs.Tag = dsJobs.Tables[0].Rows.Count ;

// -- Other places in the code will look to the tag property for the row count
int iRowCount = System.Convert.ToInt32(this.grdJobs.Tag) ; 
for (int iRow = 0 ; iRow < iRowCount ; iRow++)
   {
      if  ( (bool)grdJobs[iRow,1] ) 
       {
          // Do something with the items that were checked
       }
    }
            
I surprised that this is not a property.
Thanks to all who helped with this!
Chris
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform