CslaDataSource error

CslaDataSource error

Old forum URL: forums.lhotka.net/forums/t/117.aspx


gibbensr posted on Tuesday, May 16, 2006

I have used the CodeSmith templates to create an EditableRootList and an EditableChild object.  I dropped a GridView on my page, then dropped a CslaDataSource on my page, bound the datasource to my EditableRootList, and bound the GridView to the datasource.
When I run the page, though, I get this error... (none of my columns in my table are null, if that matters).  Any ideas?


Server Error in '/' Application.
--------------------------------------------------------------------------------

Value cannot be null.
Parameter name: container
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: container

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:


[ArgumentNullException: Value cannot be null.
Parameter name: container]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +83
   System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +4029
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +90
   System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +38
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +126
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +98
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +154
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99
   System.Web.UI.WebControls.GridView.DataBind() +24
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +91
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +101
   System.Web.UI.Control.EnsureChildControls() +134
   System.Web.UI.Control.PreRenderRecursiveInternal() +109
   System.Web.UI.Control.PreRenderRecursiveInternal() +233
   System.Web.UI.Control.PreRenderRecursiveInternal() +233
   System.Web.UI.Control.PreRenderRecursiveInternal() +233
   System.Web.UI.Control.PreRenderRecursiveInternal() +233
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4437


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

glenntoy replied on Tuesday, May 16, 2006

Hi gibbensr,

I believe you are using ASP .NET, if yes, you need to implement CSLADatasource_SelectObject() event. Please check Rocky's example in Project Tracker for Web for a walkthrough..

It would be something more or less like this under SelectObject()

e.BusinessObject = BusinessBaseList.GetXXXX()

 

cheers,

Glenn

gibbensr replied on Wednesday, May 17, 2006

Thanks Glenn, that was it exactly.

Copyright (c) Marimer LLC