Hey there i have a listview control on a page that will display search results, how would i display the TOTAL amount of records in the label text for lblTotalRecords?
ive tried to put a statement in the databound event in codebehind but that only display the current amount of VISIBLE items i want the TOTAL amount.
Thnere may be better ways, but you could do a second listview on the same page (make the listview itsefl not visible) that brings all the records, and then display how many records are in that listview.
CHO, Homepage Doctor
ASP.NET Database Tutorials
http://www.homepagedoctor.com
Turns out that the easiest way to get the TOTAL count of the Listview Control's Items is as follows:
Dim dv As System.Data.DataView = DirectCast(SqlDataSource1.[Select](DataSourceSelectArguments.Empty), DataView)
Dim resultcount As Integer = Math.Round(dv.Count)
Create a Dataview Object set to the Datasource and then get the record count off that...
Hope this assists anyone else with this issue!
Marked as answer by cmdevuk on Feb 24, 2013 12:53 PM
cmdevuk
Member
44 Points
75 Posts
Listview Control Databound To SQLDatasource > Get TOTAL Record Count
Feb 23, 2013 01:09 PM|LINK
Hey there i have a listview control on a page that will display search results, how would i display the TOTAL amount of records in the label text for lblTotalRecords?
ive tried to put a statement in the databound event in codebehind but that only display the current amount of VISIBLE items i want the TOTAL amount.
Can anyone help?
ClarkNK
Member
471 Points
371 Posts
Re: Listview Control Databound To SQLDatasource > Get TOTAL Record Count
Feb 23, 2013 09:20 PM|LINK
Thnere may be better ways, but you could do a second listview on the same page (make the listview itsefl not visible) that brings all the records, and then display how many records are in that listview.
ASP.NET Database Tutorials
http://www.homepagedoctor.com
cmdevuk
Member
44 Points
75 Posts
Re: Listview Control Databound To SQLDatasource > Get TOTAL Record Count
Feb 24, 2013 12:53 PM|LINK
Turns out that the easiest way to get the TOTAL count of the Listview Control's Items is as follows:
Dim dv As System.Data.DataView = DirectCast(SqlDataSource1.[Select](DataSourceSelectArguments.Empty), DataView) Dim resultcount As Integer = Math.Round(dv.Count)Create a Dataview Object set to the Datasource and then get the record count off that...
Hope this assists anyone else with this issue!