HOW TO POPULATE COMMON BOOTSTRAP MODAL POPUP WINDOW FOR MANY PAGES IN MVC

Harsh kumar srivastava

Total Post:34

Points:238
C#  Mvc4  Razor 
C#
 269  View(s)
Ratings:
Rate this:
<div class="modal fade" id="modelDialog" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">

    <div class="modal-dialog modal-lg" role="document">
        <div id='modelContent'>
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title"></h4>
                </div>
                <div id="main body">
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-success">Submit</button>
                    <button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
                </div>
                <div>
                </div>
            </div>
        </div>
    </div>
</div>

  1. Jack Williams

    Post:2

    Points:14
    Re: How to populate common bootstrap modal popup window for many pages in mvc

    Hi Harsh,

    You need to use your some code in _Layout.cshtml file in your shared folder.

    and remaining code use in your render page.

    Use your code like this:

    1. Code in _Layout.cshtml file:

    <div class="modal fade" id="modelDialog" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    
        <div class="modal-dialog modal-lg" role="document">
            <div id='modelContent'>
            </div>
        </div>
    </div>

    2. Code in your render page: 

    <div class="modal-content">
    
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title"></h4>
        </div>
        <div id="main body">
        </div>
        <div class="modal-footer">
            <button type="submit" class="btn btn-success">Submit</button>
            <button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
        </div>
        <div>
        </div>
    </div>

    Hope this helpful for you.



Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!