Thanks, Saravana, Carlso. And, as Carlos suggested in his reply, I do have a function that uses the DataView to get the count as shown here
Function PassengerCount(ByVal DataItem As Object) As Integer
Dim drv As DataRowView = DataItem
Dim intPassengers As Integer
intPassengers = drv.DataView.Count()
PassengerCount = intPassengers
End Function
Though I'm not certain that's the most efficient way to do it. But, because I'm using BoundColumns in the ASP.NET page, I can't call this function as the value of HeaderText for one of those BoundColumns. I can use GetChildRelation from the DataList one level above the DataGrids, get a count from the resulting DataView and display the results there. But I want to show the count with each DataGrid not just once in the containing DataList. But generating a DataView twice instead of once seems wasteful.
Any thoughts about how to display the results in the header of the DataGrids?
----- Saravana [MVP] wrote: -----
You can calculate the count using datagrid.items. But datagrid items will
include header,footer and pager. If you have any of these items, then
substract these from datagrid.items. Then it will give you total number of
items in that datagrid. I hope this should help you
--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com
Allen Davis said:
I have a DataGrid in an ASP.NET page that is the third of three nested
controls (2 DataLists and the DataGrid). It uses relations in the DataSet
and a DataView RowFilter to determine what data to bind to and display. What
I'd like to do is show a count of items in the DataGrid header but I can't
find a method for this. Does anyone have any suggestions?