添加CSS样式表
<style type="text/css">
/*AutoComplete flyout */
.autocomplete_completionListElement
{
visibility : hidden;
margin : 0px!important;
background-color : white;
color : windowtext;
border : buttonshadow;
border-width : 1px;
border-style : solid;
cursor : 'default';
overflow-y : scroll;
overflow-x : hidden;
text-align : left;
height:100px;
list-style-type : none;
}
/* AutoComplete item */
.autocomplete_listItem
{
background-color : window;
color : windowtext;
padding : 1px;
}
/* AutoComplete highlighted item */
.autocomplete_highlightedListItem
{
background-color: #316AC5;
color: white;
padding: 1px;
}
</style>
AutoCompleteExtender使用样式:
<cc1:AutoCompleteExtender ID="txtLB_AutoCompleteExtender" runat="server" DelimiterCharacters="|" Enabled="True"
MinimumPrefixLength="1" ServiceMethod="GetTextStringLB" ServicePath="WebService.asmx" TargetControlID="txtLB" UseContextKey="True"
CompletionInterval="100" CompletionSetCount="30"
CompletionListCssClass="autocomplete_completionListElement"
CompletionListItemCssClass="autocomplete_listItem"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
>
</cc1:AutoCompleteExtender >
这样就可以让自动完成功能实现下拉列表形式,出现滚动条。