Click here to Skip to main content
15,844,387 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I want to fetch huge datas into gridview from SQL.Fetched the datas and when binding I am getting above title error.

Full error mentioned below.
[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
   System.Web.UI.EventValidationStore.Hash(String target, String argument) +70
   System.Web.UI.DefaultEventValidationProvider.RegisterForEventValidation(String uniqueId, String argument) +179
   System.Web.UI.ClientScriptManager.RegisterForEventValidation(String uniqueId, String argument) +136
   System.Web.UI.ClientScriptManager.GetPostBackEventReference(Control control, String argument, Boolean forUrl, Boolean registerForEventValidation) +9669071
   System.Web.UI.WebControls.MenuRendererStandards.GetPostBackEventReference(MenuItem item) +94
   System.Web.UI.WebControls.MenuRendererStandards.RenderItemLinkAttributes(HtmlTextWriter writer, MenuItem item, Int32 level, String cssClass, Boolean needsAccessKey) +361
   System.Web.UI.WebControls.MenuRendererStandards.RenderItem(HtmlTextWriter writer, MenuItem item, Int32 level, String cssClass, Boolean needsAccessKey) +94
   System.Web.UI.WebControls.MenuRendererStandards.RenderItems(HtmlTextWriter writer, Boolean staticOnly, MenuItemCollection items, Int32 level, Boolean needsAccessKey) +411
   System.Web.UI.WebControls.MenuRendererStandards.RenderContents(HtmlTextWriter writer, Boolean staticOnly) +309
   System.Web.UI.WebControls.Menu.Render(HtmlTextWriter writer) +245
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +216
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386


What I have tried:

Tried to fetch the datas using DataReader again the same issue is getting.
Posted
Updated 16-Apr-18 23:36pm

1 solution

Why? What use do you think that will be?

Think about it: you fetch huge amounts of data into a gridview and throw it at the user. How long do you think he is going to sit there scrolling through an enormous list trying to find the information he is interested in? And that's ignoring how long it is going to take to load, and how much data it's going to use on a mobile device...
Do you think he's going to come back to your site?

Don't do it. Filter it, search it, page it. Give the user control over what you present to him, and he'll come back for more - and find his data better as well. But just throwing all the data at him is rude, lazy and not going to be a success (even if you could get round the memory problems, which you probably can't without talking to your hosting service).
There is a reason Google only gives you one page of data at a time: how often do you look at the 1,000,000th link of 2,000,000? How often do you even look at page three of Google results?
 
Share this answer
 
Comments
Member 11658469 17-Apr-18 4:57am    
Thanks for the reply.When I apply the paging the issue resolved.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900