Modal Pop Up in mvc 5 [closed]

孤街醉人 提交于 2021-02-07 10:48:24

问题


I want to open modal window when user click create new link.

Mvc automatically generates create view in default but it open in another page. I want it to load in Bootstrap pop-up


回答1:


Please Use below example.

Button/Link, Here I am take button

  <button type="button" name="btnLink" id="btnLink">Open Pop</button>

Model Pop : put ending of the page

<div class="modal fade" id="ModalPopUp" role="dialog">
<div class="modal-dialog err-pop" style="">
    <div class="modal-content">
        <div class="modal-header">
            <button id="DivClose" type="button" class="close" data-dismiss="modal">&times;</button>
        </div>
        <div class="modal-body" style="text-align:center;">
            Put Your Html Element Here
        </div>
    </div>
</div>

Script:

<script src="https://code.jquery.com/jquery-1.10.0.min.js"
    integrity="sha256-2+LznWeWgL7AJ1ciaIG5rFP7GKemzzl+K75tRyTByOE="
    crossorigin="anonymous"></script>
<script>
    $("#btnLink").click(function () {
        $('#ModalPopUp').modal('show');
    })
</script>


来源:https://stackoverflow.com/questions/54277982/modal-pop-up-in-mvc-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!