I have a simple multiselect like so:
@(Html.Kendo().MultiSelectFor(x => x.CourseId)
.DataValueField("Id")
.DataTextField("Name")
.Placeholder("Select Course...")
.ClearButton(false)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCourseCodeList", "Home");
})
.ServerFiltering(true);
})
.MaxSelectedItems(1)
.HtmlAttributes(new { @class = "" }))
When I enter text, the search is submitted once with the text entered, then a second time with the Placeholder text, or if no Placeholder, with empty string.
public JsonResult GetCourseCodeList(string text, int categoryId=0)
{
var items = _courseData.Where(x =>
x.Name.Contains(text) &&
(categoryId == 0 || x.CategoryId == categoryId)).OrderBy(x => x.Name).ToList();
var userinput = text;
var result = new JsonResult
{
JsonRequestBehavior = JsonRequestBehavior.AllowGet,
Data = items
};
return result;
}
A sample project replicating the issue is here : https://github.com/SteveWortho/TLCKendoTest
It must be something simple I am doing wrong - any advice appreciated.
Using;
VS2017 Pro Version 15.5.1
KendoUI MVC 2017.3.1026
Chrome Version 63.0.3239.132 or Microsoft Edge or FireFox. Issue is repeatable.
So I must be firing the onChange event a second time with some of this configuration maybe?
But it is such a simple example.
Thanks in advance,
Steve