Sveta Antrapovich Sveta Antrapovich - 9 months ago 102
ASP.NET (C#) Question

Kendo autocomplete undefined value

I'm trying to make an autocomplete ( core)

Razor view:

.Placeholder("Type user name...")
.Events(e =>
.DataSource(source =>
source.Read(read =>
read.Action("GetUsers", "User").Data("onAdditionalData");
.HtmlAttributes(new { style = "width:30%" })
.Template("<span class=\"k-state-default\">\\#=users.Email\\#</span>"))

Server side:

public dynamic GetUsers(string term)
return ctx.Users.Where(x => x.Email.ToUpper().Contains(term.ToUpper()))
.Select(res => new { id = res.Id.ToString(), name = res.Email }).ToList();

In my view I always get right number of value, but it is always "undefined". Where I`m wrong?


You are renaming "Email" to "name" in your server-side action; So you should use