You must Sign In to post a response.
  • Category: ASP.NET

    ASP.Net Web Form Grid

    I am having doubt at what way we can bind 2 lakhs records from database in gridview and also how to export the same records to excel
  • #763549
    My suggestion

    1. Do not bind 2 lakhs of records together in the gridview. That will cause big performance issue.

    2. You can go for paging.
    > Get total count of records.
    > Read only first page records and bind it.
    > Based on total counts you can handle the pagination.
    > According to the page number get the records and bind it.

    3. You can do this in JQuery AJAX call also.

    By Nathan
    Direction is important than speed

  • #763550
    There is direct way to bind very large data to gridview you need to customize the logic
    first we will check whether the data is already being cached or not. If not, then we will fetch all the records from the database and store it in cache. We will display limited records depending on page index and page size on each request. We will calculate StartingRowIndex and MaximumRecords,
    e.g. If page index is 1 and page size is 10, then startingRowIndex will be 0 and MaximumRecords will be 10, so we will return 10 rows from datatable from 0 to 9. Likewise if page index is 2 and page size is 10, then startingRowIndex will be 10 and MaximumRecords will be 10, so we will return 10 rows from datatable starting from 10 to 19.
    see below link for more details

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #763552
    My suggestion:-
    You have needed to implement paging technology.There are two kinds of paging client side paging (for getting all records) and server side paging (request the amount of data necessary from database) .

    To export the record to excel, go through following link

  • #763553

    As per my understand the post I suggest you to implement the paging concept in SQL procedure side load fixed records in each and every page and bind the same into grid while export also export with pagination this will help you to implement the same.

    Refer below links for your reference.

    Pagination in SQL

    Export with pagination

    Hope this will helpful to you..

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #763556

    My suggestion is also to use paginated query which will help to reduce data as well as network traffic.If you retrieve 2,00,000 records at a time then, it definitely slows down the performance of your operation.So, better idea to have a paginated query and it will display the data page by page.

    Suppose, you fetch first top 100 records in one page and in the second page next 100 records it will continue in this way until and unless it's reaching to it's maximum record level.

    For Exporting data's from Gridview to excel sheet, follow the below links :-

    Thanks & Regards,

  • #763681
    Hai Maheshwari,
    There is no point to show these many records to the GridView as the user cant get the relevant information from it.
    You need to keep some filter so that you should be able to filter and show only limited and relevant records.
    Keep the paging so that the user can move to the next page records and more filter criteria will keep them aware to get the limited records.
    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

Sign In to post your comments