I am working on an MVC project and want to create a modal popup on button click. But without using J-query. Is this possible? if so give some suggestions guys Thanks in advance!
Asked
Active
Viewed 261 times
-1
-
have a look: https://stackoverflow.com/questions/16778336/modal-dialog-without-jquery – Nomi Ali Apr 02 '19 at 06:54
-
Use can try bootstrap model. – Rai Vu Apr 02 '19 at 06:54
-
Possible duplicate of [Modal Dialog without jQuery](https://stackoverflow.com/questions/16778336/modal-dialog-without-jquery) – Rai Vu Apr 02 '19 at 06:55
-
You can use javascript – Nomi Ali Apr 02 '19 at 06:55
-
Thanks, @RaiVu but can't we call the partial view on Controller side and using CSS to make it as popup in middle of the page – Dark Devil Apr 02 '19 at 06:56
-
Please have look this link:- https://stackoverflow.com/questions/29380011/mvc-how-to-get-controller-to-render-partial-view-initiated-from-the-view – Nirav Vasoya Apr 02 '19 at 07:56
1 Answers
0
Use bootstrap modal
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Show popup
</button>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
@Html.Partial("yourView")
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>

Alaaeddine HFIDHI
- 878
- 4
- 12