How to Add Bootstrap Modal View in Asp.Net Webform Tutorial


This is a short tutorial of how to create/add a simple Bootstrap Modal View into an ASP.Net project. The tutorial can help you to know what are the requirements and how it is being done. This will also helps you to understand how to add/convert the modal view into project.

Here, I will show the code that present a modal button which fires/open the modal when clicked. In the same page the modal interface scripts are also included.

Index/Main Page

The following script is the code for the main script which is the main interface of the simple project that contains the Interface Script and Modal Interface Script. It also includes the script that loads the Bootstrap library and other links.

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ModalView.aspx.cs" Inherits="Crud_Operation.ModalView" %>
  3. <!DOCTYPE html>
  5. <html xmlns="">
  6. <head runat="server">
  7. <link rel="stylesheet" type="text/css" href="modal.css">
  8. <link rel="stylesheet" href="">
  9. <link rel="stylesheet" href="">
  10. <script src="" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  11. <script src=""></script>
  12. <script src=""></script>
  13. </head>
  14. <form id="form1" runat="server">
  16. <div class="container">
  17. <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#form">
  18. See Modal with Form
  19. </button>
  20. </div>
  21. <div class="modal fade" id="form" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style="display: none;">
  22. <div class="modal-dialog modal-dialog-centered" role="document">
  23. <div class="modal-content">
  24. <div class="modal-header border-bottom-0">
  25. <h5 class="modal-title" id="exampleModalLabel">Create Account</h5>
  26. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  27. <span aria-hidden="true">×</span>
  28. </button>
  29. </div>
  30. <form>
  31. <div class="modal-body">
  32. <div class="form-group">
  33. <label for="email1">Email address</label>
  34. <input type="email" class="form-control" id="email1" aria-describedby="emailHelp" placeholder="Enter email">
  35. <small id="emailHelp" class="form-text text-muted">Your information is safe with us.</small>
  36. </div>
  37. <div class="form-group">
  38. <label for="password1">Password</label>
  39. <input type="password" class="form-control" id="password1" placeholder="Password">
  40. </div>
  41. <div class="form-group">
  42. <label for="password1">Confirm Password</label>
  43. <input type="password" class="form-control" id="password2" placeholder="Confirm Password">
  44. </div>
  45. </div>
  46. <div class="modal-footer border-top-0 d-flex justify-content-center">
  47. <button type="submit" class="btn btn-success">Submit</button>
  48. </div>
  49. </form>
  50. </div>
  51. </div>
  52. </div>
  54. <div>
  55. </div>
  56. </form>
  57. </body>
  58. </html>


Video Link for this tutorial:

I hope this tutorial will help you with what you are looking for. Next post I will add the project for complete crud operation, and we will add data into the database using the same modal view.

Happy Coding!!

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment