【问题标题】:How to use jQuery autocomplete using aspx URL?如何使用 jQuery 自动完成使用 aspx URL?
【发布时间】:2011-02-02 13:27:31
【问题描述】:

我一直将我的“数据”存储在我正在撰写的页面上的下拉列表中。但是用户现在不想看到该下拉列表。如果我让它消失,它提供给我的自动完成数据的数据就会消失。所以我想我会创建一个单独的 .aspx 页面并以这种方式调用它。它不工作。你觉得我做错了什么?

这是 $(document.ready(function) 中的 jQuery 调用:

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

这是 .aspx 页面。它调用两种返回字符串列表的方法之一:

protected void Page_Init(object sender, 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);
                }
            }
        }

【问题讨论】:

    标签: asp.net jquery autocomplete


    【解决方案1】:

    自动完成 jQuery 片段正在寻找“q”。我使用的是我自己的自定义标识符。另外,我需要使用 StringBuilder 并逐行写出每个项目。

    【讨论】:

      猜你喜欢
      • 2011-06-06
      • 1970-01-01
      • 1970-01-01
      • 2014-02-24
      • 1970-01-01
      • 2015-06-20
      • 1970-01-01
      相关资源
      最近更新 更多