我有以下内容:
public void ProcessRequest(HttpContext context)
{
string query = context.Request.QueryString["term"];
System.Web.Script.Serialization.JavaScriptSerializer JsonSerializer =
new System.Web.Script.Serialization.JavaScriptSerializer();
List<Category> Categs = Category.getAll();
var result = from c in Categs where Categs.Contains(c.Name) select c;
context.Response.ContentType = "application/json";
context.Response.Write(JsonSerializer.Serialize(result));
}
尝试为 jQuery UI 自动完成返回 [ { label: "Choice1", value: "value1" }, ... ] 列表。我有具有 ID 和 Name 属性的类别,我想根据查询字符串和 Name 属性中的“术语”过滤列表。我该怎么做?
提前致谢。