rupesh gour

rupesh gour

  • 1.6k
  • 116
  • 6.5k

my model popup not opening

Jan 18 2024 11:18 AM

my model popup not opening with control button 
Opening with input type = button

my code is given below

HTML

<head runat="server">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>VB.NET Modal Popup Example</title>
</head>
<body>
    <form runat="server">
        <!-- Your HTML content goes here -->

        <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal">
            Open Modal
        </button>
        <asp:Button ID="Button1" runat="server" Text="POPUP"   CssClass="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal" />

        <!-- The Modal -->
        <div class="modal fade" id="myModal">
            <div class="modal-dialog">
                <div class="modal-content">
                    <!-- Modal Header -->
                    <div class="modal-header">
                        <h4 class="modal-title">Modal Heading</h4>
                        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                    </div>

                    <!-- Modal Body -->
                    <div class="modal-body">
                        <p>This is the modal content.</p>
                    </div>

                    <!-- Modal Footer -->
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                        <%--<asp:Button ID="btnSaveChanges" runat="server" Text="Save Changes" CssClass="btn btn-primary" OnClientClick="return confirm('Are you sure you want to save changes?');" OnClick="btnSaveChanges_Click" />--%>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!-- Bootstrap JavaScript Bundle (includes Popper) -->
</body>
</html>

-----------------------------------------------------------------------------------------------------------------------------------
click event is

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ClientScript.RegisterStartupScript(Me.GetType(), "showModal", "$('#myModal').modal('show');", True)
End Sub

Please Suggest How to do it ???


Answers (3)