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

    Gridview Binding Issue - 10000 Records

    Hello All,

    I am using gridview to show data and up to 500 records i am no issue when showing the data.

    Now, I have near about 9500 records to show in gridview and not to use paging, So all records should be on same page.

    I am getting error. Says,
    "An exception of type 'System.OutOfMemoryException' occurred in System.Web.dll but was not handled in user code"

    I am looking in this issue for last couple of days, but no luck.

    Thanks in advance.
  • #769095
    In gridview Item Template field also used
    Chirag - 48
    Enjoy With Errors
    chirag.madhani@yahoo.com

    Delete Attachment

  • #769099
    Do not use datagrid paging logic, it just get all rows from database and try to attach to gridview as data source, instead you can try using SQL paging it is easy and will help to reduce application load

    --EXEC [GetAppsDetails] 1,10
    ALTER PROCEDURE [dbo].[GetAppsDetails]
    @PageIndex INT,
    @RecordsPerPage INT
    AS
    BEGIN
    SET NOCOUNT ON
    Declare @startRowIndex INT;
    Declare @endRowIndex INT;
    set @endRowIndex = (@PageIndex * @RecordsPerPage);
    set @startRowIndex = (@endRowIndex - @RecordsPerPage) + 1;

    With RecordEntries as (
    SELECT ROW_NUMBER() OVER (ORDER BY A.APP_TYPE_ID ASC) as Row, _
    A.APP_TYPE_ID,
    A.APP_TYPE_NAME,A.APP_STORE_ID,R.REVIEW_TITLE,R.AUTHOR_NAME,_
    R.REVIEW_DATE,
    R.REVIEW_RATING,R.REVIEW_TEXT FROM [dbo].[APP_TYPES] A
    INNER JOIN [CUSTOMER_APP_REVIEWS] R ON A.APP_TYPE_ID=R.APP_TYPE_ID
    )
    Select APP_TYPE_ID, APP_TYPE_NAME, APP_STORE_ID, REVIEW_TITLE, AUTHOR_NAME,
    REVIEW_DATE, REVIEW_RATING, REVIEW_TEXT
    FROM RecordEntries
    WHERE Row between
    @startRowIndex and @endRowIndex

    SELECT COUNT(*) FROM [dbo].[APP_TYPES] A
    INNER JOIN [CUSTOMER_APP_REVIEWS] R ON A.APP_TYPE_ID=R.APP_TYPE_ID
    END

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

  • #769100
    Hi

    Thanks for your response. but i don't want paging or any kind of custom paging. I want all data (9500 records) on single page.

    Chirag - 48
    Enjoy With Errors
    chirag.madhani@yahoo.com

  • #769112
    Hi Chirag,

    This is because of Memory issue you got this type of error, there is not enough memory in your RAM. As suggested by prasad try to implement paging that is the best option if you don't want paging then increase the RAM size. but without paging shows all the records in single page is not acceptable.

    Still you want to show all the records in single page then implement gridview scrolling while scroll down load the next set of records.

    In our terminology we call it as Load on demand gridview.

    Refer below piece of code

    http://www.dotnetspider.com/resources/46303-Load-on-demand-data-in-Gridview-using-Jquery.aspx

    Hope this helps you...

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

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


  • Sign In to post your comments