Hello-
I'm struggling a little bit with the grid. I have it all working fairly nicely and now I want to put some dropdowns in. The samples all seem to use options.DataSource([object]) and not .DataSourceUrl. When I use DataSourceUrl, I can see the Controller method being called.
The difficulty I'm having is that no matter what I return, the dropdown is empty. I used the same Controller pattern as the DataSourceUrl for the Grid:
[GridDataSourceAction]public ActionResult GetAccounts(){ using (var cont = new Models.MyDBEntities()) { var accts = cont.accounts.Select(acct => new { AccountCode = acct.AccountCode, AccountName = acct.AccountName }).ToList(); return View(accts.AsQueryable());
}}
But no matter what I return (whether it's IQueryable<T> or not), nothing winds up in the dropdown.
Hi efanstay
i solved this problem many time ago, this is the code of my combo():
@(Html.Infragistics().ComboFor(model => model.idEstado).ID("ddEstados").EnableClearButton(false).DropDownButtonTitle("Estados").Mode(ComboMode.DropDown).TextKey("Nombre").ValueKey("idEstado").Width("210px").DataSource(@Url.Action("GetEstados")).DataBind().Render())
and my controller action look like this:
[AcceptVerbs(HttpVerbs.Get)]public ActionResult GetEstados(){ LargeJsonResult DataView = new LargeJsonResult() { JsonRequestBehavior = JsonRequestBehavior.AllowGet }; DataView.Data = from p in da.Estados orderby p.Nombre select p; return DataView;}
really i hope this can help you.
Regards.
Christhian