奇怪的UpdatePanel和Extender控件错误

时间:2014-05-21 06:31:19

标签: asp.net .net ajaxcontroltoolkit

我在母版页中有以下标记,当我使用该母版访问页面时,我收到错误:

  

扩展程序不能位于与控件不同的UpdatePanel中   延伸。

<asp:UpdatePanel ID="UpdatePanel99" runat="server">
  <ContentTemplate>
    <script type="text/javascript">
      function OnAutoCompleteSelected(source, eventArgs) {
        $("#autoCompleteHidden").val(eventArgs._text);
        __doPostBack("autoCompleteHidden", "");
      }
    </script>
    <table>
      <tr>
        <td style="height: 25px">Search By
        </td>
        <td>
          <asp:DropDownList ID="ddlSearchBy" runat="server" OnSelectedIndexChanged="ddlSearchBy_SelectedIndexChanged"
            AutoPostBack="True">
            <asp:ListItem>Emp No</asp:ListItem>
            <asp:ListItem>ID No</asp:ListItem>
            <asp:ListItem>Surname</asp:ListItem>
          </asp:DropDownList>
        </td>
        <td>
          <asp:ImageButton ID="imgBtnSearch" runat="server" Height="20px" ImageUrl="~/Images/Apps/mySearch2.png"
            Width="20px" OnClick="imgBtnSearch_Click" />
        </td>
      </tr>
      <tr>
        <td colspan="3" style="height: 25px; margin-left: 80px;">
          <div>
            <asp:HiddenField runat="server" ID="autoCompleteHidden" OnValueChanged="autoCompleteHidden_ValueChanged" />
            <asp:TextBox ID="txtSearchField" runat="server" Width="200px"></asp:TextBox>
            <ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server" TargetControlID="txtSearchField"
              ServicePath="~/AutoComplete.asmx" ServiceMethod="GetEmployees" Enabled="False" CompletionInterval="100"
              MinimumPrefixLength="1" CompletionSetCount="10000" OnClientItemSelected="OnAutoCompleteSelected"
              CompletionListCssClass="CompletionList" CompletionListItemCssClass="CompletionListItem" CompletionListHighlightedItemCssClass="CompletionListHighlightedItem">
            </ajaxToolkit:AutoCompleteExtender>
          </div>
        </td>
      </tr>
    </table>
  </ContentTemplate>
</asp:UpdatePanel>

母版页上只有一个UpdatePanel,扩展控件txtSearchField仅包含在其中。我做错了什么?

1 个答案:

答案 0 :(得分:0)

我在AutoCompleteExtender之外的同一文本框中找到了另一个UpdatePanel