This is a migrated thread and some comments may be shown as answers.

server filtering

1 Answer 55 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 10 Dec 2015, 11:56 PM
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();
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 14 Dec 2015, 12:25 PM
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
Tags
DropDownList
Asked by
Mark
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or