'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?
Solution 1:[1]
i used masterpage . 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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Koray |
