BFry
BFry

Reputation: 915

Add pagination and count of records in footer of asp.net gridview

I have an asp.net grid view. I have already implemented pagination (page 12345678910....) where you click on page number and it takes you to that page.

I want to add a functionality in the same row as of pagination which shows "Showing 210 records". That is, which shows the total count of records currently showing in the grid.

Any pointers ? I want page numbers and the text message to be shown in same footer row.

Upvotes: 0

Views: 2104

Answers (1)

Chris
Chris

Reputation: 5108

Have a look at this: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pagecount%28v=vs.110%29.aspx

You will need to provide a custom <pagertemplate> where you will insert a custom label, lets say totalRecordCount. Then in your code behind, you will need to get the total row count of your data using LINQ or any other method you like and assign it to the custom label text.

I hope this helps.

Upvotes: 0

Related Questions