我使用AutoCompleteExtender從Ajax控件工具包,它是stragely行爲。Ajax控件工具包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
...
這就是我想要的東西,但是當我把它綁在文本框和類型在00056,我得到的結果:
56399
24015
24017
56717
56721
...
這說明兩個問題:
- 到底發生到我的零是什麼?我怎樣才能讓他們回來?
- 這些「240xx」數字來自哪裏?甚至在xml文檔中都沒有這些值!
我完全被這個難住了,請幫我:)
他們都串 - 這是奇怪的一部分; 我放棄了工具包,並用jQuery代替http://naspinski.net/post/Using-jqueryautosuggestjs-with-AspNet.aspx – naspinski 2009-02-04 06:11:15