当 Textbox 通过 AJAX Toolkit AutoComplete 扩展时,面板 DefaultButton 不起作用
我正在使用 ASP.NET 面板为某些控件(如 TextBox)设置默认按钮,但由于 AJAX 控件工具包的 AutoCompleteExtender,它似乎不起作用。 请帮忙..!
代码如下:
<asp:Panel ID="pnlSearchBox" runat="server" class="search-main-box" DefaultButton="lnkSearch">
<asp:TextBox ID="txtLocation" runat="server" CssClass="input-field" MaxLength="200" style="width: 182px; margin-bottom: 7px;"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx" ID="aceLocation" TargetControlID="txtLocation" ServicePath="~/autocomplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1" CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20" CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";, :" ShowOnlyCurrentWordInCompletionListItem="true" >
<Animations>
<OnShow>
<Sequence>
<%-- Make the completion list transparent and then show it --%>
<OpacityAction Opacity="0" />
<HideAction Visible="true" />
<%-- Expand from 0px to the appropriate size while fading in --%>
<Parallel Duration=".4">
<FadeIn />
<Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx')._height" />
</Parallel>
</Sequence>
</OnShow>
<OnHide>
<%-- Collapse down to 0px and fade out --%>
<Parallel Duration=".4">
<FadeOut />
<Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx')._height" EndValue="0" />
</Parallel>
</OnHide>
</Animations>
</ajaxToolkit:AutoCompleteExtender>
<div class="btn-search"><asp:LinkButton ID="lnkSearch" runat="server" class="btn-search-bg" OnClick="lnkSearch_Click"><span>Search</span></asp:LinkButton>
</div>
</asp:Panel>
I am using ASP.NET Panel to set Default Button for some Controls like TextBox but it seems to not work due to AJAX Control Toolkit's AutoCompleteExtender.
Pls help.. !
Code is as below:
<asp:Panel ID="pnlSearchBox" runat="server" class="search-main-box" DefaultButton="lnkSearch">
<asp:TextBox ID="txtLocation" runat="server" CssClass="input-field" MaxLength="200" style="width: 182px; margin-bottom: 7px;"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx" ID="aceLocation" TargetControlID="txtLocation" ServicePath="~/autocomplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1" CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20" CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";, :" ShowOnlyCurrentWordInCompletionListItem="true" >
<Animations>
<OnShow>
<Sequence>
<%-- Make the completion list transparent and then show it --%>
<OpacityAction Opacity="0" />
<HideAction Visible="true" />
<%-- Expand from 0px to the appropriate size while fading in --%>
<Parallel Duration=".4">
<FadeIn />
<Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx')._height" />
</Parallel>
</Sequence>
</OnShow>
<OnHide>
<%-- Collapse down to 0px and fade out --%>
<Parallel Duration=".4">
<FadeOut />
<Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx')._height" EndValue="0" />
</Parallel>
</OnHide>
</Animations>
</ajaxToolkit:AutoCompleteExtender>
<div class="btn-search"><asp:LinkButton ID="lnkSearch" runat="server" class="btn-search-bg" OnClick="lnkSearch_Click"><span>Search</span></asp:LinkButton>
</div>
</asp:Panel>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这样做:
将其添加到页面头标记中的脚本标记中:
编辑为使用 jQuery
上面的代码和 jquery 没有太大区别:
do like this:
add this in script tag in your page head tag :
Edited to use jQuery
there is no much difference between code above and jquery :