开发者

How to use jQuery autocomplete using aspx URL?

I had been storing my "data" in a dropdown that was also on the page I am writing about. But the user doesn't want to see that dropdown now. If I make it go away, the data it was providing to my autocomplete data goes away. So I figured I would create a separate .aspx page and call it that way. It's not working. What do you think I'm doing wrong?

Here is the jQuery call in $(document.ready(function):

$('[id$=txtEntry2]').autocomplete("LookupCodes.aspx?type=IC", { mustMatch: true });

Here is the .aspx page. It calls one of two methods that return a list of strings:

protected void Page_Init(object send开发者_运维百科er, EventArgs e)
        {
            //get the parameter from the query string, pass to fetch data
            string whichSearch = Request.QueryString["type"];

            //FC = FeedCode, IC = Ing. Code
            if (whichSearch == "FC")
            {
                List<string> feedCodes = SearchFeedCodes();
                foreach (string feedCode in feedCodes)
                {
                    Response.Write(feedCode);
                }
            }
            else //IC
            {
               List<string> ingCodes = SearchIngredientCodes();
                foreach (string ingCode in ingCodes)
                {
                    Response.Write(ingCode);
                }
            }
        }


the autocomplete jQuery piece is looking for "q". I was using my own custom identifier. Also, I needed to use StringBuilder and write out each item line by line.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜