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.
Hi Bomlin,
<ErrorTemplate>No data</ErrorTemplate>
In the meantime we'll research and fix that issue. Thanks for reprting it!
<ig:WebDataGrid ID="UI_grdMemos" runat="server"
Width="800px"
style="margin-right: 1px">
<EmptyRowsTemplate>
No rows found
</EmptyRowsTemplate>
<ErrorTemplate>
</ErrorTemplate>
<Behaviors>
<ig:RowSelectors>
</ig:RowSelectors>
ColumnSelectType="Multiple" RowSelectType="Single">
</ig:Selection>
<ig:Sorting Enabled="true" SortingMode="Single"></ig:Sorting>
<ig:ColumnResizing>
</ig:ColumnResizing>
<ig:Filtering>
</ig:Filtering>
</Behaviors>
<Columns>
<ig:BoundDataField DataFieldName="Id" Key="Id" Width="70px">
<Header Text="Memo ID" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Title" Key="Title" Width="250px">
<Header Text="Title" />
<ig:BoundDataField DataFieldName="CurrentUserName" Key="CurrentUserName">
<Header Text="Current User" />
<ig:BoundDataField DataFieldName="LastUpdate" Key="LastUpdate">
<Header Text="LastUpdate" />
<ig:BoundDataField DataFieldName="Status" Key="Status">
<Header Text="Status" />
<ig:BoundDataField DataFieldName="Priority" Key="Priority">
<Header Text="Priority" />
</Columns>
</ig:WebDataGrid>
In which version it is fixed? I'm using the laitest version, 2008v3 .NET 3.5 with new Aikido CTP. And I'm experiencing the same problem basically, but I'm not sure if this is related to the same bug though.
In my case, when data source returns zero rows, the exception is thrown declaring that DataKeyField is invalid.
I'm using the latest WebDataGrid and ObjectDataSource as it's data source. ObjectDataSource returns simple IEnumerable<T> of objects. I have disabled AutoGenerateColumns and manually added only one column. DataKeyField is also specified.
Fixed.
Sorry for the inconvenience and thank you for bringing that to our attention!
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?
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).