[英]Showing BootBox with button click in asp.net
嗨,我是初學者,自己學習asp.net。 我想使用Bootbox顯示一個確認對話框。 我進行了很多搜索,但找不到解決方案。 引導箱文檔確實也不精確。
這是模式對話框的asp.net代碼:
<!--BootBox Dialog --> <div id="myModal" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <button type="button" class="close" data-dismiss="modal">×</button> Are you Sure from master page? </div> <div class="modal-footer"><asp:Button runat="server" CssClass="btn btn-primary" ID="okButton" Text="OK"/></div> </div> </div> </div>
並通過按鈕:
<asp:LinkButton runat="server" ID="EditButton" CssClass="btn btn-primary" ClientIDMode="Static"> <i class="fa fa-edit"></i> Edit Selected </asp:LinkButton>
引導JavaScript顯示確認對話框:
<script> $("#myModal").on("show", function() { // wire up the OK button to dismiss the modal when shown $("#myModal a.btn").on("click", function(e) { console.log("button pressed"); // just as an example... $("#myModal").modal('hide'); // dismiss the dialog }); }); $("#myModal").on("hide", function() { // remove the event listeners when the dialog is dismissed $("#myModal a.btn").off("click"); }); $("#myModal").on("hidden", function() { // remove the actual elements from the DOM when fully hidden $("#myModal").remove(); }); $("#myModal").modal({ // wire up the actual modal functionality and show the dialog "backdrop" : "static", "keyboard" : true, "show" : true // ensure the modal is shown immediately }); </script>
我應該在哪里傳遞按鈕的ID並顯示模式? 請幫忙。
用這個-
$("#EditButton").on("click", function(){
//在這里做你的東西}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.