Your search did not match any results.
List

Web API Service

Documentation
This example demonstrates the List widget loading data from a Web API service.

ASP.NET MVC

ASP.NET Core

@(Html.DevExtreme().List() .ItemTemplate(@<text> <div><%= ProductName %></div> <div><b><%= Globalize.formatCurrency(UnitPrice, "USD") %></b></div> </text>) .DataSource(d => d.WebApi().Controller("ListData")) .DataSourceOptions(d => d .PageSize(1) .Sort("ProductName") .Group("Category.CategoryName") .Filter("[ 'UnitPrice', '>', '15' ]") ) .Grouped(true) .CollapsibleGroups(true) .ItemDeleteMode(ListItemDeleteMode.SlideItem) .SelectionMode(ListSelectionMode.Multiple) .ShowSelectionControls(true) .PageLoadMode(ListPageLoadMode.ScrollBottom) .Height(600) )
using DevExtreme.MVC.Demos.Models.SampleData; using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class ListController : Controller { public ActionResult WebApi() { return View(); } } }
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Web.Http; using DevExtreme.MVC.Demos.Models.Northwind; namespace DevExtreme.MVC.Demos.Controllers.ApiControllers { public class ListDataController : ApiController { NorthwindContext _nwind = new NorthwindContext(); [HttpGet] public HttpResponseMessage Get(DataSourceLoadOptions loadOptions) { return Request.CreateResponse( DataSourceLoader.Load(_nwind.Products.Include("Category"), loadOptions) ); } } }