问题描述
||
我正在尝试使用jQuery显示asp:ModalPopupExtender,但没有成功。这是我所拥有的:
ASP.NET
<asp:ModalPopupExtender BehaviorID=\"confirmPopup\" ID=\"confirmPopup\" runat=\"server\" />
JAVASCRIPT
function ShowConfirmPopup() {
var _id = \'#<%= confirmPopup.ClientID %>\';
var modal = $find(_id);
modal.show();
}
发生的情况是modal
始终等于null
,因此从不显示弹出窗口。我究竟做错了什么?
解决方法
$ find()不是jQuery的一部分,而是ASP.NET AJAX的一部分。因此,您不应该在行为ID前面加上一个井号:
function ShowConfirmPopup()
{
var modal = $find(\"confirmPopup\");
modal.show();
}