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.
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/
Not sure if this will help anyone else or not. Perhaps it will just point out how new I am to ASP.Net. LOL
I ran into this error and was scratching my head over it. I got this while stepping through the code in Visual Studio. I go the "Break, Continue, or Ignore" box and if I hit ignore, I would get the same number of lines in the grid as I had objects in the bound list. But no data.
After checking, sure enough, I had forgotten to put any methods for Get and Set on the properties of the objects that the bound list contained. I added just the simeple { get; set; } after my properties and the error went away.
Seems there are some problems with sorting behavior also, when IEnumerable return no rows. I have set some columns as sortable and also set a default sorting. Now when executing I got NullReferenceException in method
Infragistics.Web.UI.GridControls.Sorting.BehaviorEvents_PreRender(Object sender) +373Infragistics.Web.UI.GridControls.PreRenderHandler.Invoke(Object sender) +0Infragistics.Web.UI.GridControls.GridBehaviorEvents.OnPreRender() +22Infragistics.Web.UI.GridControls.GridRenderer.RenderContents(HtmlTextWriter writer) +79
This exception is not catched by the ErrorTemplate. Because when I remove the default sort, the ErrorTemplate is displayed as it should be (because IEnumerable returned no rows).
Looks like the schedule date has been delayed. Is it possible to get that fix any time sooner (in Februrary)? Or are there any other work arounds besides the ErrorTemplate?