Reputation: 103
I Have Use Kendo-Drop Down box in my Application, I Want Add Searchable Functionality in this Drop down box but it is not working .. so please any budy help me ..
@(Html.Kendo().DropDownList()
.Name("PCODE")
.OptionLabel("--Select--")
.HtmlAttributes(new { style = "width:100%;" })
.DataTextField("PCODE")
.DataValueField("EmpId")
.HtmlAttributes(new { @class = "kendo-Drop-PCode" })
.Filter("contain")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetEmployeeList", "Common");
})
.ServerFiltering(true);
}
)
)
Upvotes: 0
Views: 1491
Reputation: 4497
A couple of things I have picked up:
1) .Filter needs to say .Filter("contains") rather than Filter("contain")
2) If you intend to do server filtering you need to send back the value of the inputted text to the server and then handle that as part of the request e.g.
source.Read(read =>
{
read.Action("GetEmployeeList", "Common").Data("GetFilterValue")
})
function GetFilterValue()
{
return {filterValue: $("#PCODE").data("kendoDropDownList").filterInput.val() };
}
In your controller then modify the signature to accept the input value:
public JsonResult GetEmployeeList(string filterValue = "")
{
do something in here....
}
Upvotes: 1