简体   繁体   中英

Bootstrap 5 Show Modal Code Behind (Asp.net C#)

I tried everything but I couldn't success it.

 <script type="text/javascript"> function openModal() { var myModal = new bootstrap.Modal(document.getElementById('KullaniciAramaSonuc'), {}); myModal.show(); } </script>
 <div class="modal fade" id="KullaniciAramaSonuc" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="staticBackdropLabel">Şifre İşlemleri</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Kapat"></button> </div> <div class="modal-body"> <asp:Label ID="lblMesaj" CssClass="h5" runat="server"></asp:Label> </div> <div class="modal-footer"> <button type="button" class="btn btn-btn-primary" data-bs-dismiss="modal">Kapat</button> </div> </div> </div> </div>

When I call the method codebehind nothing happens. But when I try it with bootstrap 4.3 it works. Can anyone help me?

I used masterpage and I found solution for bootstap5 modal , like this:

1-change function like this:

function openModalAddSchool() 
{ 
    var myModal = new bootstrap.Modal(document.getElementById('myModalAddSchool'), { keyboard: false }); 
    myModal.show(); 
} 

2- take bootstrap.js and poper uppersite . after css

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM