Either I am not understanding what you want, or you are missing a few concepts.
If you're not using paging, the DataGrid displays all records. Thus, the Items.Count returns all records currently displayed in the grid.
If you want to know all the records in the initial data source, ask the datasource ;)
Suppose you create a dataset with a query like this:
SELECT Col1, Col2 FROM YourTable WHERE SomeCriteria = SomeValue.
Let's say your *database* table holds 100 records, and that 20 are returned by this query. Let's also say your Grid has a PageSize of 10
Then this:
YourDataSet.Tables(0).Rows.Count
returns 20, as that is the number of records in a *DataTable* inside the DataSet, not the total number of records in the table in the *database*.
This:
MyDataGrid.Items.Count returns 10
and this:
SELECT COUNT(*) FROM YourTable
returns 100
So, now you can count whatever you want: items in the grid (Items.Count), items in the datasource (Tables(0).Rows.Count) or items in the database table (SELECT COUNT(*) FROM YourTable)
Is there anything more to count??
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
You Think I Ain't Worth A Dollar, But I Feel Like A Millionaire by
Queens of the Stone Age (Track 2 from the album:
Songs For The Deaf)
What's This?