server filtering

2 posts, 0 answers
  1. Mark
    Mark avatar
    2 posts
    Member since:
    Nov 2015

    Posted 10 Dec 2015 Link to this post

    below is the code on the documentation page for server filtering a dropdownlist  

    http://demos.telerik.com/aspnet-mvc/dropdownlist/serverfiltering

    Does this actually do anything ? 

     

    namespace Kendo.Mvc.Examples.Controllers
    {
        using System.Web.Mvc;
     
        public partial class DropDownListController : Controller
        {
            public ActionResult ServerFiltering()
            {
                return View();
            }
        }
    }
  2. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 14 Dec 2015 Link to this post

    Hello Mark,

    Indeed the mvc code, does not shows the proper implementation of the demo - this will be fixed. However, you can revise the proper controller and method in your offline demos(GetProducts action in Home controller). The actual logic, in the controller is as follows:

    public JsonResult GetProducts(string text)
            {
                var northwind = new SampleEntities();
     
     
                var products = northwind.Products.Select(product => new ProductViewModel
                {
                    ProductID = product.ProductID,
                    ProductName = product.ProductName,
                    UnitPrice = product.UnitPrice ?? 0,
                    UnitsInStock = product.UnitsInStock ?? 0,
                    UnitsOnOrder = product.UnitsOnOrder ?? 0,
                    Discontinued = product.Discontinued
                });
     
                if (!string.IsNullOrEmpty(text))
                {
                    products = products.Where(p => p.ProductName.Contains(text));
                }
     
                return Json(products, JsonRequestBehavior.AllowGet);
            }


    Regards,
    Nencho
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top