Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

showing an asp:ModalPopupExtender using jQuery

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?

like image 913
JF Beaulieu Avatar asked May 26 '11 18:05

JF Beaulieu


1 Answers

$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();
}
like image 89
Frédéric Hamidi Avatar answered Sep 21 '22 23:09

Frédéric Hamidi