Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
575
Grid crashes when datasource function returns zero results
posted

I have my grid set up with a datasource pulling from an ADO .NET Entity Framework model. 

Controller

model.GridModel.DataSource = _db.InstrumentLists.Where(clause, SearchTerm)
                                                                .ToList<InstrumentList>()
                                                                .OrderBy(x => x.Tag)
                                                                .AsQueryable<InstrumentList>();

View

@( Html.Infragistics().Grid("InsrumentListGrid", Model.GridModel)

 

I am setting the DataSource and not the DataSourceUrl on purpose - all the paging, filtering and sorting is done client side.

The records that are pulled out depend on a search string, hence the Where clause.  If the result of the call is zero records, the grid crashes with a Null Reference Exception.

Here's the top of the stack:

[NullReferenceException: Object reference not set to an instance of an object.]
   Infragistics.Web.Mvc.GridModel.CheckNullables() +341
   Infragistics.Web.Mvc.GridModel.DataBind() +1173
   Infragistics.Web.Mvc.InfragisticsSuite`1.Grid(String id, IGridModel gridViewModel) +278
   ASP._Page_Views_InstrumentList_Index_cshtml.Execute() in c:\Users\DNatoli\Documents\Visual Studio 2010\Projects\ICMDB\ICMDB\Views\InstrumentList\Index.cshtml:39
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
   System.Web.WebPages.StartPage.RunPage() +19
Parents
No Data
Reply
  • 24671
    posted

    Hi,

    I checked that the fix is in build 11.1.20111.2017. That was released on 25th of July. The service release with build 2010 was released on 6th of July. Let me know if you can't find the 25th July SR with build 2017 and I will let you know how I can help.

    Thanks,

    Angel

Children