我试图显示一个模式弹出窗口,以显示网格中选定记录的详细信息。在模态弹出窗口中设置每个控件的值后,我尝试打开它,但失败了。
我已在网站母版页中包含了所有必需的引用,但始终获取“对象不支持属性或方法‘modal’”错误:
在母版页中:
<head runat="server">
<meta charset="utf-8" />
<meta http-equiv="cache-control" content="no-cache, no-store" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />
<title><%: Page.Title %></title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-json/2.6.0/jquery.json.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<meta name="viewport" content="width=device-width" />
<asp:ContentPlaceHolder runat="server" ID="HeadContent" />
</head>
javascript代码:
function setDetailFields(record, clear) {debugger
// populate controls in modal
var reqID = record["RequestID"];
...
$('#spnRequestID').text(reqID);
...
//$('#detailModal').modal({ backdrop: 'static', keyboard: false });
$('#detailModal').modal('show');
}
ASPX:
<div class="modal fade" id="detailModal" role="dialog" aria-labelledby="catModalLabel" aria-hidden="true">
<div class="modal-dialog fade in modal-lg ui-draggable">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Something</h4>
</div>
<div class="modal-body">
...
</div>
</div>
</div>
</div>
....