Hello,
I have this code on my index.cshtml:
@(Html.Kendo().MultiSelect()
.Name("selectedmembers")
.Placeholder("Please select the members on the job...")
.DownArrow(true)
.AutoClose(false)
.DataTextField("MemberName")
.DataValueField("MemberId")
.Filter("contains")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetPeople", "Combo");
});
})
)
And my GetPeople code looks like this:
public JsonResult GetPeople(string text)
{
using (var db = new chilternModel())
{
var members = db.Members.Select(member => new Member()
{
MemberName = member.MemberName,
MemberId = member.MemberId
});
return Json(members.ToList());
}
}
When I run the code I get undefined as the text value. The database is a mySql running locally.
I have checked the members variable and it has the appropriate information for a jsonResult to be returned, but the control seems to ignore the text field (and I assume the MemberId as well)
Thanks in advance.
Michael
Hi Ivaylo,
Thank you for the sample. As soon as I started looking, I noticed the problem immediately. I was missing the following line:
builder.Services.AddMvc().AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);
As soon as I added this, it worked like a charm.
Thanks for all your help.
Michael