Modal Pop Up in mvc 5

12,324

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>
Share:
12,324
Vlădel
Author by

Vlădel

Updated on December 08, 2022

Comments

  • Vlădel
    Vlădel 11 months

    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

    • TanvirArjel
      TanvirArjel almost 5 years
      You should have posted at least minimum code that you have tried.
    • Admin
      Admin almost 5 years
      I'm new to mvc. I tried so many codes.i deleted those codes. i need statrt scratch
  • Azhar
    Azhar almost 5 years
    @Salman if you have any issue ask me.
  • Admin
    Admin almost 5 years
    Azhar it is working. thank you. but i want default create view inside the that pop up can you help for that. from index page to call add new page inside that pop up
  • Azhar
    Azhar almost 5 years
    please share create page code
  • Admin
    Admin almost 5 years
    Azhar thank you for support. i did it my self. now it's working
  • Admin
    Admin almost 5 years
    i need help content load to modal but when i click save it not saving.
  • Azhar
    Azhar almost 5 years
    you need to add post method
  • Admin
    Admin almost 5 years
    @Azahr Post Method in form tag?
  • Azhar
    Azhar almost 5 years
    yes, and in controller [httpPost] Methode name
  • ARLibertarian
    ARLibertarian almost 3 years
    An external link?
  • Azhar
    Azhar almost 3 years
    @ARLibertarian which external link?