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
85
infragistics combo load on demand with remote binding
posted

Hi Infragistics Team,

I'm new to infragistics tools and i'm having trouble in making the igCombo work with load on demand settings and remote binding. I looked into few samples in the help site but nothing explains how to do remote bind with controller method call. Here is a sample code

View:

@(Html.Infragistics().Combo()

                            .MultiSelection(ComboMultiSelection.OnWithCheckboxes)

                             .LoadOnDemandSettings(load=>load.Enabled(true).PageSize(25))

                              .DataSourceUrl(Url.Action("GetAllLocations"))

                              //.FooterTemplate("<div class='boxed'>{0} of {3} Locations</div>")

                              //.Virtualization(true).AutoComplete(true).FilteringCondition("startsWith")

                              .FilteringType(ComboFilteringType.Remote)

                              //.ResponseDataKey("d.results")                            

                              .ID("SearchPCLocations")

                              .NullText("All")

                              .ValueKey("ID").TextKey("Number")

                              .DataBind()      

                              .Render())

[ComboDataSourceAction]

        public ActionResult GetAllLocations()

        {

            _processLocation = new ProcessLocation();

            IEnumerable<SRP.Core.Data.Models.Location> locations = _processLocation.GetAllLocations();

            return View(locations.AsQueryable());

        }

There is no problem w/ controller call and the method indeed returns JSON results but it’s not getting bound to the combo. so I'm not sure what's wrong here.

Appreciate your support. It will be really great if you can share some samples which works w/ controller methods.

Thanks,

Karthik

Parents
No Data
Reply
  • 1775
    Suggested Answer
    posted

    Hi, Karthik

    The combo box control expects a JSON to be returned from the remote call and your controller action method returns a web page response (the View() part). That is the reason why you cannot make it work. I suggest that you change your controller action method to something like this:

    1. public ActionResult GetAllLocations()
    2. {
    3.     _processLocation = new ProcessLocation();
    4.  
    5.     IEnumerable<SRP.Core.Data.Models.Location> locations = _processLocation.GetAllLocations();
    6.  
    7.     return new JsonResult {
    8.         Data = locations,
    9.         JsonRequestBehavior = JsonRequestBehavior.AllowGet
    10.     };
    11. }

    Regards, Lazar 

     

    EDIT: Hi, Karthik. Please, disregard the example I provided above. I did not take into account the remote filtering and LoD features being used together and concentrated only on the remote data. Your controller action is correct, having remote filtering enabled. Here in the team we investigated and discussed this example and we found that a problem exists with previous releases that creates a conflict between LoD and remote filtering. If you get the new release of our product which is due to be released very soon, you will get this problem fixed.

Children
No Data