关闭Ajax:按下转义键的PopupControlExtender

时间:2012-12-13 03:52:41

标签: javascript jquery asp.net popup ajaxcontroltoolkit

如何关闭Ajax:使用javascript或Jquery按下转义键的PopupControlExtender? 下面是我的html标记相同。

<td>
     <asp:TextBox ID="txtTechnologyCombo" runat="server" Width="105" ReadOnly="true" TabIndex="7">
     </asp:TextBox>
     <Ajax:PopupControlExtender ID="pceTechnology" runat="server" TargetControlID="txtTechnologyCombo"
           PopupControlID="pnlTechnology" Position="Bottom">
      </Ajax:PopupControlExtender>
      <input type="hidden" name="hidTechnologyVal" id="hidTechnologyVal" runat="server" />
      <asp:Panel ID="pnlTechnology" runat="server" Style="max-height: 150px; min-width: 160px;
           overflow-y: scroll; overflow-x: hidden; padding-right: 20px;" BackColor="#f9faf6"
           BorderColor="Gray" BorderWidth="1">
           &nbsp;<asp:CheckBox ID="chkTechnologyAll" runat="server" Text="All" CssClass="chklist" />
           <asp:CheckBoxList ID="chkTechnologyList" CssClass="chklist" runat="server">
           </asp:CheckBoxList>
    </asp:Panel>
    <asp:DropDownList runat="server" ID="ddlTechnology" Style="width: 110px;" Visible="false">
    </asp:DropDownList>
</td>

我需要单个函数,可用于关闭所有PopupControlExtender,因为我有超过10个这样的块。

1 个答案:

答案 0 :(得分:1)

尝试以下代码:

$(document).keyup(function(e) {
    if (e.keyCode == 27) 
  { 
     $("#pceTechnology").hide();
  }   // esc
});