I am trying to fire a Bootstrap Modal at the end of a section of code behind by calling a Javascript function, it will run the alert() that is in the function but steadfastly refuses to display any modal I try.
Code behind partial :-
ScriptManager.RegisterStartupScript(Me, Page.GetType(), "Script", "openModal();", True)
And the Javascript Function on the content page :-
<%@ Page Title="" Language="vb" AutoEventWireup="False" MasterPageFile="~/Site.Master" CodeBehind="clientprocess.aspx.vb" Inherits="UPARS.clientprocess" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="true">
</asp:ScriptManager>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<style>
.GridViewClass td, th {
padding: 4px;
}
</style>
<script type="text/javascript">
function openModal() {
alert("howdy");
$('#chqPayModal').modal('show');
}
</script>
And the Modal code:-
<pre> <div class="modal modal-dialog-centered fade " id="chqPayModal" tabindex="-1" role="dialog" aria-labelledby="chqPayModal" aria-hidden="true">
<div class="modal-dialog " role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-5">
<div class="form-group">
<input type="text" class="form-control" id="chqNumber" placeholder="Cheque Number">
</div>
<div class="form-group">
<input type="text" class="form-control" id="chqAmount" placeholder="Cheque Value">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" runat="server" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" onclick="chqTransfer();" class="btn btn-primary">Save </button>
</div>
</div>
</div>
</div>
What I have tried:
I can fire this modal no problem with a button on the content page, but not from code behind, although the alert() part does fire.
Hope someone has some idea as I surely don't ....