Ajax AutoCompleteExtender文本框未触发Edge浏览器中的文本更改事件

时间:2019-03-20 07:09:25

标签: asp.net ajax microsoft-edge autocompleteextender

我在文本框(ASP.NET)上使用Ajax AutoCompleteExtender,并且已连接文本更改事件。当我输入文本框时,系统能够成功地从asmx方法中获取数据,但是与自动完成文本框相关的文本更改事件不会被触发。这仅在Edge浏览器中发生。我在chrome和IE中测试了该网站,并且运行正常。要添加此问题,当我升级到最新版本的Ajax Control Kit时开始出现。当我单击提交按钮时,文本更改事件也会被触发。这就像在触发其他事件时触发了文本更改事件。

下面是代码段。

<asp:TextBox ID="AutoTxtCompany" runat="server" aria-describedby="ContentPlaceHolder1_rfvCustomerCompany" AutoPostBack="true" CssClass="ui-autocomplete-input ui-widget ui-widget-content comboBoxDimensionsTextBox" OnTextChanged="AutoTxtCompany_TextChanged" aria-required="true" />  
<asp:AutoCompleteExtender ID="autoextAutoTxtCompany" BehaviorID="autoextcompanyautocomplete" runat="server" TargetControlID="AutoTxtCompany" MinimumPrefixLength="1" EnableCaching="false"
CompletionSetCount="5000" CompletionInterval="100" ServiceMethod="getCompanyList"                       CompletionListCssClass="autocomplete_completionListElement" ServicePath="~/FrontEnd/AutoComplete.asmx" UseContextKey="true" FirstRowSelected="true">
</asp:AutoCompleteExtender>

1 个答案:

答案 0 :(得分:0)

尝试使用AutoCompleteExtender控件的 OnClientItemSelected 事件来触发Textbox TextChanged事件。像这样的代码:

<script type="text/javascript" >
    function DoTextChangedPostBack(source, eventArgs) {
        var hfield = $get('<%=AutoTxtCompany.ClientID%>');
        hfield.value = eventArgs.get_value();
        __doPostBack("<%=AutoTxtCompany.ID%>", "TextChanged");
    }
</script>
<div>           
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:TextBox ID="AutoTxtCompany" runat="server" aria-describedby="ContentPlaceHolder1_rfvCustomerCompany" 
        AutoPostBack="true" CssClass="ui-autocomplete-input ui-widget ui-widget-content comboBoxDimensionsTextBox" 
        OnTextChanged="AutoTxtCompany_TextChanged" aria-required="true" />  
    <ajaxtoolkit:autocompleteextender id="autoextAutoTxtCompany" behaviorid="autoextcompanyautocomplete" runat="server"
        targetcontrolid="AutoTxtCompany" minimumprefixlength="1" enablecaching="false"
        completionsetcount="5000" completioninterval="100" servicemethod="getCompanyList" 
        completionlistcssclass="autocomplete_completionListElement" servicepath="FrontEnd/AutoComplete.asmx" 
            OnClientItemSelected="DoTextChangedPostBack" 
        usecontextkey="true" firstrowselected="true">
    </ajaxtoolkit:autocompleteextender>
</div>