C# 在ASP.NET 4.5中的AutoCompleteXtender中添加滚动条

C# 在ASP.NET 4.5中的AutoCompleteXtender中添加滚动条,c#,asp.net,.net,scrollbar,autocompleteextender,C#,Asp.net,.net,Scrollbar,Autocompleteextender,现在我有一个关于在ASP.NET 4.5中的AutoCompleteXtender中添加滚动条的问题。 我想开发文本框与自动完成系统添加滚动条。 但是,正如下面的代码所示,我无法使scrollbar添加自动完成系统 我的代码如下 aspx&cs文件 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AutoCompletEextender.aspx.cs" Inherits="AutoCompleteTest6.AutoCo

现在我有一个关于在ASP.NET 4.5中的AutoCompleteXtender中添加滚动条的问题。 我想开发文本框与自动完成系统添加滚动条。 但是,正如下面的代码所示,我无法使scrollbar添加自动完成系统

我的代码如下

aspx&cs文件

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AutoCompletEextender.aspx.cs" Inherits="AutoCompleteTest6.AutoCompletEextender" %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <ajaxToolkit:AutoCompleteExtender
                ID="TextBox1_AutoCompleteExtender"
                runat="server"
                CompletionInterval="50"
                CompletionSetCount="40"
                EnableCaching="False"
                MinimumPrefixLength="0"
                ServiceMethod="GetAutoCompTestListAAAA"
                ServicePath="AutoCompList.asmx"
                TargetControlID="TextBox1">
            </ajaxToolkit:AutoCompleteExtender>
        </form>
    </body>
    </html>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace AutoCompleteTest6
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class AutoCompList : System.Web.Services.WebService
    {

        [WebMethod]
        public string[] GetAutoCompTestListAAAA(string prefixText, int count)
        {
            string[] aAutoComp = new string[]{
            "ActionScript",
            "AppleScript",
            "Asp",
            "BASIC",
            "C",
            "C++",
            "Clojure",
            "COBOL",
            "ColdFusion",
            "Erlang",
            "Fortran",
            "Groovy",
            "Haskell",
            "Java",
            "JavaScript",
            "Lisp",
            "Perl",
            "PHP",
            "Python",
            "Ruby",
            "Scala",
            "Scheme"};

            string[] filterdList = aAutoComp.Where(str => (0 <= str.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase))).ToArray();
            return filterdList;
        }
    }
}

使用制度;
使用System.Collections.Generic;
使用System.Linq;
使用System.Web;
使用System.Web.Services;
名称空间自动完成测试6
{
[WebService(命名空间=”http://tempuri.org/")]
[WebServiceBinding(ConformsTo=WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
公共类自动完成列表:System.Web.Services.WebService
{
[网络方法]
公共字符串[]GetAutompTestListAAAA(字符串前缀,整数计数)
{
字符串[]自动编译=新字符串[]{
“动作脚本”,
“AppleScript”,
“Asp”,
“基本”,
“C”,
“C++”,
“Clojure”,
“COBOL”,
“ColdFusion”,
“二郎”,
“Fortran”,
“好极了”,
“哈斯克尔”,
“爪哇”,
“JavaScript”,
“口齿不清”,
“Perl”,
“PHP”,
“Python”,
“红宝石”,
“斯卡拉”,
“计划”};

string[]filterlist=aAutoComp.Where(str=>(0添加一个div来保存y轴上滚动溢出的列表元素将有助于自动完成扩展程序

请尝试对aspx页面进行以下更改:

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <div id="listPlacement" style="height:100px; overflow-y:scroll;" ></div>
        <ajaxToolkit:AutoCompleteExtender
            ID="TextBox1_AutoCompleteExtender"
            runat="server"
            CompletionInterval="50"
            CompletionSetCount="40"
            CompletionListElementID="listPlacement"
            EnableCaching="False"
            MinimumPrefixLength="0"
            ServiceMethod="GetAutoCompTestListAAAA"
            ServicePath="AutoCompList.asmx"
            TargetControlID="TextBox1">
        </ajaxToolkit:AutoCompleteExtender>
    </form>
</body>
</html>

感谢您回答我的问题!!!我可以在AutoCompleteXtender中添加滚动条。