Show Bootstrap popup Modal from code in Asp.Net C#

Hi, today ill show to how to show Bootstrap Popup Modal from code in asp. Here is a sample modal

<div id="your_modal_name" class="modal fade animated" role="dialog">
                                                                    <div class="modal-dialog">
                                                                        <div class="modal-content">
                                                                            <div class="modal-header">
                                                                                <button type="button" class="close"
                                                                                    data-dismiss="modal">
                                                                                    &times;</button>
                                                                                <h4 class="modal-title">Sales Record</h4>
                                                                            </div>
                                                                            <div class="modal-body">
                                                                                      <p>Add Content Here</p>
                                                                            </div>
                                                                            <div class="modal-footer">
                                                                                <button type="button" class="btn btn-default" data-dismiss="modal">
                                                                                    Close
                                              
                                                                                </button>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
and now add this script on the top of your page below the Head tag

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

add a button and on click event write this :

 protected void Button1_Click(object sender, EventArgs e)
        {
                   ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "qwerty();", true);
        }
and you're done..!! enjoy...:)

Comments

Popular posts from this blog

How to show multiple markers on Google maps from database in ASP.Net

How to Solve Bootstrap Tooltip disappearing inside a updatepanel control when a button is click or in postback in ASP.NET

Show Bootstrap Popup Modal from inside a Repeater in Asp.Net