Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How many rows in a datagrid?
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00844332
Message ID:
00844531
Views:
12
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
Previous
Reply
Map
View

Click here to load this message in the networking platform