Getting this error after calling JavaScript function with Bootbox from code behind after I upgraded to bootstrap 5. But works fine if I call the same function from my aspx page.
Error: Uncaught Error: "$.fn.modal" is not defined; please double check you have included the Bootstrap JavaScript library. See https://getbootstrap.com/docs/5.1/getting-started/introduction/ for more details.
I've included all the dependencies.
My aspx code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="include/js/jquery-1.12.4.js"></script>
<script src="include/js/jquery.min.js" type="text/javascript"></script>
<script src="include/js/jquery-ui.min.js" type="text/javascript"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
<script src="include/js/part/bootbox.min.js"></script>
<script type="text/javascript">
function AlertMessage() {
bootbox.alert({
title: "My title",
message: "My Custom Message.....!!!",
});
return false;
}
$(document).ready(function () {
/*AlertMessage();*/
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
My Code behind :
protected void Page_Load(object sender, EventArgs e)
{
Page.RegisterStartupScript("Getdata", "<script type=text/javascript>AlertMessage();</script>");
}
Works fine when I call it from document ready. But shows error when called from code behind. Already tried Page.ClientScript.