2017-09-13 35 views
1

我在我的頁面中使用了asp:AutoCompleteExtender控件。如何在autoComplete彈出時觸發javacript函數?

這裏是控制:

<asp:AutoCompleteExtender ID="txtStreet_AutoCompleteExtender" runat="server" DelimiterCharacters="" 
     Enabled="True" MinimumPrefixLength="2" ServiceMethod="GetCompletionList" ServicePath="" 
     TargetControlID="txtStreet"> 
    </asp:AutoCompleteExtender> 

我也有javascript函數命名sizeCalc(autoCompleteHeight)功能有一個名爲autoCompleteHeight是得到了autoComplete彈出的高度參數。

我的問題是如何在autoComplete彈出窗口出現並傳遞autoComplete彈出窗口的高度時觸發sizeCalc函數?

回答

0

這裏它被炒到MinimumPrefixLength,所以我們要根據這個來檢查。

這是使用jQuery假設它是一個普通的文本框,或者你需要給你的服務器控件一個clientID屬性。

$('#txtStreet').keyup(function() { 
    if(this.value.length > 2) 
{ 
    //your code 
} 
}); 
相關問題