最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - showing an asp:ModalPopupExtender using jQuery - Stack Overflow

programmeradmin2浏览0评论

I am trying to show an asp:ModalPopupExtender using jQuery, without any success. Here is what I have :

ASP.NET

<asp:ModalPopupExtender BehaviorID="confirmPopup" ID="confirmPopup" runat="server" />

JAVASCRIPT

function ShowConfirmPopup() {
    var _id = '#<%= confirmPopup.ClientID %>';
    var modal = $find(_id);
    modal.show();
}

What happens is that modal is always equal to null, so the popup never gets shown. What am I doing wrong?

I am trying to show an asp:ModalPopupExtender using jQuery, without any success. Here is what I have :

ASP.NET

<asp:ModalPopupExtender BehaviorID="confirmPopup" ID="confirmPopup" runat="server" />

JAVASCRIPT

function ShowConfirmPopup() {
    var _id = '#<%= confirmPopup.ClientID %>';
    var modal = $find(_id);
    modal.show();
}

What happens is that modal is always equal to null, so the popup never gets shown. What am I doing wrong?

Share Improve this question asked May 26, 2011 at 18:42 Jean-François BeaulieuJean-François Beaulieu 4,45522 gold badges77 silver badges113 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

$find() is not part of jQuery, but of ASP.NET AJAX. Therefore, you should not prefix the behavior id with a hash sign:

function ShowConfirmPopup()
{
    var modal = $find("confirmPopup");
    modal.show();
}
发布评论

评论列表(0)

  1. 暂无评论