asp.net - OutOfMemoryException Binding ObjectDataSource to GridView -


i'm trying use gridview show table pulled sql server. log of events. i've placed gridview control on page along objectdatasource control. i've configured :

<%@ page language="vb" %>  <!doctype html public "-//w"     "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head>     <title></title> </head> <body>     <form id="form1" method="post" runat="server">     <asp:gridview id="gvhistory" runat="server" datasourceid="dshistory">     </asp:gridview>     <asp:objectdatasource id="dshistory" runat="server" selectmethod="gethistoryrows"         typename="aspdotnetstorefrontadmin.roiimporthistory"></asp:objectdatasource>     </form> </body> </html> 

i've created class in app_code folder follows:

imports system.data  namespace aspdotnetstorefrontadmin      public class roiimporthistory          public shared function gethistoryrows() datatable              dim localdatatable new datatable              localdatatable.columns.add()             localdatatable.columns.add()             localdatatable.columns.add()             localdatatable.rows.add(new object() {"hi", "hi2", "hi3"})              return localdatatable          end function     end class  end namespace 

however, following exception when try run this:

what going wrong? thought doing pretty basic thing here. i've tried lots of different options , know page works fine if remove either gridview or objectdatasource. if bind datatable directly gridview things work correctly.

my purpose true pagination along filtering. given working more than't want load datatable every time page loads.

server error in '/' application. exception of type 'system.outofmemoryexception' thrown. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.  exception details: system.outofmemoryexception: exception of type 'system.outofmemoryexception' thrown.  source error:  unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below.  stack trace:   [outofmemoryexception: exception of type 'system.outofmemoryexception' thrown.]    system.reflection.assembly._gettype(string name, boolean throwonerror, boolean ignorecase) +0    system.web.ui.util.gettypefromassemblies(icollection assemblies, string typename, boolean ignorecase) +201    system.web.compilation.buildmanager.gettype(string typename, boolean throwonerror, boolean ignorecase) +302    system.web.ui.webcontrols.objectdatasourceview.gettype(string typename) +70    system.web.ui.webcontrols.objectdatasourceview.executeselect(datasourceselectarguments arguments) +1692    system.web.ui.datasourceview.select(datasourceselectarguments arguments, datasourceviewselectcallback callback) +27    system.web.ui.webcontrols.databoundcontrol.performselect() +261    system.web.ui.webcontrols.basedataboundcontrol.ensuredatabound() +82    system.web.ui.webcontrols.compositedataboundcontrol.createchildcontrols() +95    system.web.ui.control.ensurechildcontrols() +146    system.web.ui.control.prerenderrecursiveinternal() +61    system.web.ui.control.prerenderrecursiveinternal() +224    system.web.ui.control.prerenderrecursiveinternal() +224    system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) +3394   version information: microsoft .net framework version:2.0.50727.6400; asp.net version:2.0.50727.6387  

i've referenced this , this no avail.

note: found code runs fine loaded site on same server in same application pool. therefore believe has configuration issue.

i think may using objectdatasource incorrectly here.

my understanding of objectdatasource give type records, , "select method" return collection of record data type.

alternately, use entity framework objectdatasource.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -