In this article I will explain with an example, how to display (show) jQuery UI Dialog Modal Popup box after PostBack in ASP.Net using C# and VB.Net.

The jQuery UI Dialog Modal Popup box will be displayed from Server Side after the PostBack is completed in ASP.Net.
 
 
HTML Markup
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"
    rel="stylesheet" type="text/css" />
<script type="text/javascript">
    function ShowPopup(message) {
        $(function () {
            $("#dialog").html(message);
            $("#dialog").dialog({
                title: "jQuery Dialog Popup",
                buttons: {
                    Close: function () {
                        $(this).dialog('close');
                    }
                },
                modal: true
            });
        });
    };
</script>
<div id="dialog" style="display: none">
</div>
<asp:Button ID="btnShowPopup" runat="server" Text="Show Popup" OnClick="btnShowPopup_Click" />
 
The HTML Markup consists of an HTML DIV which is the body or content of the jQuery UI Modal Dialog Popup Window, and an ASP.Net Button which when clicked will raise a server side event that will open the Popup Window.
Also I have defined a ShowPopup JavaScript function which opens jQuery UI Modal Dialog Popup Window. This function accepts the message as parameter that will be displayed inside the Popup Window.
 
 
Display (Show) jQuery UI Dialog Modal Popup after PostBack in ASP.Net
On the click of the ASP.Net Button the following event handler is raised which makes use of ClientScript RegisterStartupScript method to call the ShowPopup JavaScript function (explained earlier), which then opens the jQuery UI Modal Dialog Popup Window.
C#
protected void btnShowPopup_Click(object sender, EventArgs e)
{
    string message = "Message from server side";
    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true);
}
 
VB.Net
Protected Sub btnShowPopup_Click(sender As Object, e As System.EventArgs) Handles btnShowPopup.Click
    Dim message As String = "Message from server side"
    ClientScript.RegisterStartupScript(Me.GetType(), "Popup", "ShowPopup('" + message + "');", True)
End Sub
 
 
Screenshot
Display (Show) jQuery UI Dialog Modal Popup after PostBack in ASP.Net
 
 
Demo
 
Downloads