asp.net | Use Popup Modal in asp.net

Add this line in your page.aspx code

<script type="text/javascript">function open_Modal() {$('#name_of_the_modal').modal('show');}</script>

Add your modal (double check its ID)

 <div id="myModalerror" class="modal fade" role="dialog">
        <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"> == [ HEADER ] == </h4>
                </div>
                <div class="modal-body">

== [ CONTENT GOSE HERE ] ==

                </div>
                <div class="modal-footer">
<button type="button" class="btn btn-default ml-auto m-md-auto" data-dismiss="modal">
== [ CLOSE ] ==</button>

                </div>
            </div>

        </div>
    </div>

Use this where ever you want to fire the modal

ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Pop", "open_Modal();", True)

Note: if it didn’t work, try to move the following from the bottom of the document to the top

http://%=%20ResolveUrl(
http://%=%20ResolveUrl(
http://%=%20ResolveUrl(
http://%=%20ResolveUrl(
,

Leave a Reply

Your email address will not be published. Required fields are marked *