0

SQL Server 2008

In my table I have millions of records. Now when I try to bind all records in Gridview then It takes more time to fetch that all records.

If I want to Select only 10-10 records at a time means in Gridview first I am on first page and it display first 10 records then when I go to next page it display second 10 records likewise....

So how its possible? and Can I get total counts of that records in that store procedure?

  • you can refer to this post. http://stackoverflow.com/questions/3949966/what-would-be-the-best-way-to-fetch-around-a-million-record-from-db – Moiz Dec 08 '12 at 07:48

2 Answers2

0

In ASP.NET paging and sorting is extremely simple when hitting a SQL database for the source.

  1. Just drop an appropriate DataSource control (like EntityDataSource if you are using Entity Framework, or LinqDataSource is you are using LinqToSQL) on the page with your gridview, and configure it (clicking the little expander icon in the designer and clicking the 'Configure Data Source' link.

  2. Set that DataSource control's ID as your GridView's DataSourceID property value.

  3. On the GridView set AllowPaging="true" and the PageSize="10" (can be whatever you want for number of rows per page).

You're done

Moiz
  • 2,409
  • 5
  • 27
  • 50
0

You can create dynemic paging to load large data, can refer bellow links for help.

Custom Paging

Or

Custom Paging 2

Sagar Modi
  • 770
  • 2
  • 7
  • 29