【发布时间】:2009-01-31 07:58:13
【问题描述】:
我正在使用 Ajax Control Toolkit 中的 AutoCompleteExtender,它的行为很奇怪。
这里显示我的服务方法:
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] getEJMaps(string prefixText, int count)
{ // method that returns the auto-suggest for the EJMaps positions
string file_location = HttpContext.Current.Server.MapPath("~") + Utils.Settings.Get("attachments") + "ejmaps\\ejmaps.xml";
XElement x = XElement.Load(file_location);
string[] positions = (from p in x.Descendants("position") where p.Value.StartsWith(prefixText) orderby p.Value select p.Value).ToArray();
if (positions.Count() == 0)
return new string[] { "No Matching Results" };
else return positions;
}
如果我在具有值 getEJMaps("00056", 4) 的测试页面中调用它,它工作正常,我会得到以下结果:
00056399
00056717
00056721
00056722
00056900
...
这正是我想要的,但是当我将它绑定到 TextBox 并输入 00056 时,我得到了结果:
56399
24015
24017
56717
56721
...
这说明了两个问题:
- 我的零点到底怎么了?我怎样才能让他们回来?
- 那些“240xx”数字是从哪里来的? xml 文档中甚至没有任何具有这些值的内容!
我对此感到完全困惑,请帮助我:)
【问题讨论】:
标签: c# asp.net ajaxcontroltoolkit autocompleteextender