Current situation:

  • A DataSet connecting to a SQL Server and creating TableAdapters
  • One of the TableAdapters looks at the username of the logged on user and filters the records by user ID
  • A DetailsView on an aspx page that uses an ObjectDataSource to display that user's records

Project requirements include displaying the total number of records associated with that user in a label. Right now, I'm using a separate call to the database to do a record count and then populating the label with that info. The separate data call would seem to be unnecessary IF there is a way to look at the DetailsView to determine the number of records it currently contains. I've already tried:

  • Me.DetailsView.Rows.Count - always returned a 19 even when I verified there were 0 or 3.
  • Me.DetailsView.PageCount - always returned a 0, regardless
  • Me.DetailsView.DataItemCount - always returned a 0

Any ideas?