I have a custom business object that inherits from List<t> that I am binding to using ObjectDataSource. It works great when there is data present. However, if there is no data returned, I get the following error:
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.NotSupportedException: Data source contains no schema data.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.
[NotSupportedException: Data source contains no schema data.] Infragistics.Web.UI.GridControls.WebDataGrid.DataBind() +678 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.EnsureDataBound() +84 Infragistics.Web.UI.GridControls.WebDataGrid.EnsureDataBound() +168 Infragistics.Web.UI.GridControls.WebDataGrid.CreateChildControls() +43 System.Web.UI.Control.EnsureChildControls() +87 Infragistics.Web.UI.GridControls.WebDataGrid.EnsureChildControls() +113 System.Web.UI.Control.PreRenderRecursiveInternal() +44 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
I am completely stuck on this one. Any help would be greatly appreciated.
I get the "Data source contains no schema data" error as well, but I'm not sure if my case is different because I've placed the WebDataGrid inside a custom control and I used the custom control as a Web Part (without Sharepoint).
The web part loads fine, except when I try using the web part functionality such as minimize on the control or any other control on the same web part page I get the error.
What do I need to do to get around this?
EDIT: Ah it turns out I needed to set EnableDataViewState to true
Fixed.
Sorry for the inconvenience and thank you for bringing that to our attention!
This is a different bug but you can also use the ErrorTemplate as a workaround. We're working on resolving your case.