1
我正在使用ASP.NET面板來設置像TextBox一些控件的默認按鈕,但它似乎無法工作,由於AJAX控件工具包的AutoCompleteExtender。 請幫助..!面板DefaultButton不起作用時通過AJAX工具包擴展Textbox自動完成
守則如下:
<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>
是否有任何其他方式,如果可能,那麼通過不使用javascript或jquery ......否則jquery會少用代碼 – 2011-04-06 06:54:38
這不是很多代碼。你需要添加一個4行函數,並從你的文本框onkeydown事件中調用它。 jquery只是改變了代碼行,你可以在編輯過的部分看到。 – 2011-04-06 07:51:01