Why is AutoCompleteExtender not firing?

Posted by Antoine on Stack Overflow See other posts from Stack Overflow or by Antoine
Published on 2010-04-20T08:56:01Z Indexed on 2010/04/20 9:43 UTC
Read the original article Hit count: 718

Hi,

I have some issue with the ASP AutoCompleteExtender control. I got one in my page that is working fine, but I have put another one in the same page, and I can't get it to work. Using HTTP Analyzer, no query is fired when I type into the textbox associated with it. Has anyone an idea?

Both call the same webservice, with a different ContextKey parameter. The webservice cannot be the cause as it works in the first case (DevMgrTxtBox), and is not even called in the second (DevTxtBox). Properties of both controls are similar, I just changed the ID and targetControlID of the second.

The code below is in a ContentPlaceHolder. I'm using VS2005 with .NET 2.0. AjaxControlToolkit.dll is in version 1.0.20229.0.

EDIT: solution found. The ID is not the only thing that needs to be unique, the BehaviorID property must be unique too. Which wasn't documented.

<tr>
  <td>
    <asp:Label ID="DevtMgrLbl" runat="server" Text="Development Manager"></asp:Label>                    
  </td>
  <td>
    <asp:UpdatePanel runat="server" id="devMgrPanel">
      <contenttemplate>
        <asp:TextBox id="DevMgrTxtBox" runat="server"></asp:TextBox>
        <ajaxToolkit:AutoCompleteExtender id="AutoCompleteRole1" runat="server" CompletionSetCount="5" EnableCaching="true" BehaviorID="autoCompleteExtender" CompletionInterval="100" MinimumPrefixLength="2" ServiceMethod="GetRoleList" ServicePath="AutoCompleteRoles.asmx" TargetControlID="DevMgrTxtBox" ContextKey="DM">
        </ajaxToolkit:AutoCompleteExtender> 
      </contenttemplate>
      <triggers>
        <asp:AsyncPostBackTrigger ControlID="DevMgrTxtBox" EventName="TextChanged"></asp:AsyncPostBackTrigger>
      </triggers>
    </asp:UpdatePanel>                    
  </td>
</tr>
<tr>
  <td>
    <asp:Label ID="DevLbl" runat="server" Text="Developer"></asp:Label>
  </td>
  <td>
    <asp:UpdatePanel runat="server" id="devPanel">
      <contenttemplate>
        <asp:TextBox ID="DevTxtBox" runat="server"></asp:TextBox>
        <ajaxToolkit:AutoCompleteExtender id="AutoCompleteRole2" runat="server" CompletionSetCount="5" EnableCaching="true" BehaviorID="autoCompleteExtender" CompletionInterval="100" MinimumPrefixLength="2" ServiceMethod="GetRoleList" ServicePath="AutoCompleteRoles.asmx" TargetControlID="DevTxtBox" ContextKey="DEV">
    </ajaxToolkit:AutoCompleteExtender>
      </contenttemplate>
      <triggers>
        <asp:AsyncPostBackTrigger ControlID="DevTxtBox" EventName="TextChanged"></asp:AsyncPostBackTrigger>
      </triggers>
    </asp:UpdatePanel>                    
  </td>
</tr>

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about ajaxcontroltoolkit