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. Stack Trace: [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
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.
Hey, I just want to share that I had the same issue, here is the stack trace:
[NotSupportedException: Data source contains no schema data.] Infragistics.Web.UI.GridControls.WebDataGrid.CopyFields() +799 Infragistics.Web.UI.GridControls.WebDataGrid.FillFields() +186 Infragistics.Web.UI.GridControls.WebDataGrid.DataBind() +803 test.Page_Load(Object sender, EventArgs e) in c:\... System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
In my case, the problem was my data source was a list of Order, for instance:
List<Order> orders = new List<Order>();
Order o;
o = new Order();
o.ID = 1;
o.ClientCode = "Client1";
o.Total = 22.99;
orders.Add(o);
o.ClientCode = "Client2";
That here was the definition of my Order class:
class Order
{
public int ID;
public string ClientCode;
public double Total;
}
The problem was with the members of the class Order, although public, were simply attributes, not methods... Here is what I had to do to solve the problem (promote them to methods):
public int ID { get; set; }
public string ClientCode { get; set; }
public double Total { get; set; }
That worked just fine.
-- Wagner
http://www.wagnerdanda.me/