在MVC 5中模态弹出 [英] Modal Pop Up in mvc 5

查看:81
本文介绍了在MVC 5中模态弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户单击创建新链接时,我想打开模式窗口.

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

Mvc默认情况下会自动生成创建视图,但会在另一个页面中打开.我希望它加载到Bootstrap弹出窗口

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

推荐答案

请使用以下示例.

按钮/链接,这里是按钮

Button/Link, Here I am take button

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

模型流行:将页面结尾

<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 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>

这篇关于在MVC 5中模态弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆