In this article I will explain with an example, how to open (show) Bootstrap Modal Popup Window on Page Load in ASP.Net using C# and VB.Net.
Inside the Server Side Page Load event handler, the RegisterStartupScript method of ClientScript class is used to register a call to the JavaScript function which will open (show) Bootstrap Modal Popup Window on Client Side using jQuery.
 
 
HTML Markup
The following HTML Markup consists of an HTML DIV which will be displayed as Modal Popup Window using Bootstrap.
<!-- Bootstrap -->
<script type="text/javascript" src='https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js'></script>
<script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js'></script>
<link rel="stylesheet" href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css'
    media="screen" />
<!-- Bootstrap -->
<!-- Modal Popup -->
<div id="MyPopup" 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">
                    &times;</button>
                <h4 class="modal-title">
                </h4>
            </div>
            <div class="modal-body">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal">
                    Close</button>
            </div>
        </div>
    </div>
</div>
 
 
Open (Show) Bootstrap Modal Popup Window using jQuery
The following JavaScript function will be called from Server Side (Code Behind) inside the Page Load event handler using the RegisterStartupScript method of ClientScript class.
Inside this JavaScript function, first the title and body values are set in their respective HTML DIVs and the Bootstrap Modal Popup Window will be opened (shown) using modal function and passing the parameter value show.
<script type="text/javascript">
    function ShowPopup(title, body) {
        $("#MyPopup .modal-title").html(title);
        $("#MyPopup .modal-body").html(body);
        $("#MyPopup").modal("show");
    }
</script>
 
 
Calling the JavaScript function from Server Side (Code Behind) inside Page Load event
Inside the Page Load event handler, the ShowPopup JavaScript function is called from Server Side (Code Behind) using RegisterStartupScript method of ClientScript class.
C#
protected void Page_Load(object sender, EventArgs e)
{
    string title = "Greetings";
    string body = "Welcome to ASPSnippets.com";
    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + title + "', '" + body + "');", true);
}
 
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Dim title As String = "Greetings"
    Dim body As String = "Welcome to ASPSnippets.com"
    ClientScript.RegisterStartupScript(Me.GetType(), "Popup", "ShowPopup('" & title & "', '" & body & "');", True)
End Sub
 
 
Screenshot
Open (Show) Bootstrap Modal Popup Window on Page Load in ASP.Net
 
 
Browser Compatibility

The above code has been tested in the following browsers.

Internet Explorer  FireFox  Chrome  Safari  Opera 

* All browser logos displayed above are property of their respective owners.

 
 
Demo
 
 
Downloads