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
2165
LOAD ON DEMAN WITH MVC, PLEASE GIVE AN EXAMPLE
posted

I have this action result in a MVC 4 controller:

        [ComboDataSourceAction]
        public ActionResult GetMyResult()
        {
            var _myResult = _wcfService.GetMyResult();
            return View(_myResult.AsQueryable());
        }

_myResult is just a List<MyItem>:

    public sealed class MyItem
    {
        public int MyKey { get; set; }

        public string MyDescription { get; set; }
    }

Then I have a view like this:

@using Infragistics.Web.Mvc

<div id="MyCombo"></div>

@(Html.Infragistics().Combo("MyCombo")
      .LoadOnDemandSettings(pLoad => pLoad.Enabled(true).PageSize(25))
      .DataBind()    
      .DataSource(@Url.Action("GetMyResult"))
      .DataSourceUrl(@Url.Action("GetMyResult"))
      .ValueKey("MyKey")
      .TextKey("MyDescription")
      .Width("300px")
      .Virtualization(true)
      .AutoComplete(true)
      .FilterExprUrlKey("startsWith")
      .FilteringType(ComboFilteringType.Remote)
      .RenderMatchItemsCondition(ComboRenderMatchItemsCondition.Contains)
      .Render())

When I run the application I get this error message:

Error: Unable to get property '__count' of undefined or null reference

The examples provided by Infragistics are related to OData and Json, I have tested it and runs fine, but I don't use that in my project, I use WCF to get my data into the controller then return a view with that data. 

In the examples I see this thing:


responseDataKey: "d.results.Results",

responseTotalRecCountKey: "d.results.Count",


I understand that something similar is missed in my code but I don't know how to translate that when using Razor and my datasource.

By the way, I don't actually have a view related to the actionresult, the examples of Infragistics say you have to return a view but there are not any view source code for that in the examples, so I have no idea how that view is. Got it? ;) I just want to load on demand and reomotely the igcombo with data comming from a list converted to IQueryable or something the igcombo can manage. I use Infragistics Professional 2014 Vol. 1.

So, what's wrong with my code? 

Parents Reply Children
No Data