Question Modal not showing in Blazor

Pablo

Well-known member
Joined
Aug 12, 2021
Messages
78
Programming Experience
10+
Hello,
I'm again on my practice with Blazor. The issue now is the Modal I took from Bootstrap web page is not showing when I click the button that should make it appear.
This is the code:

HTML:
@page "/"
@inject NavigationManager navMgr

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#example">
    Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="example" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                ...
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </div>
</div>

Could you tell me what is wrong?
I appreciate your help. Thanks!
Pablo
 
Consider using a library like mudblazor or Blazorise, that includes a model component and has docs on how to use it. Much better to use someone else's wheel than reinventing your own
 
Back
Top Bottom