How to use jquery modal popup in

In this tutorial, we will discuss how to use jQuery modal popup in Asp.Net. Here, we will discuss how to display a successful message in a popup to the user.

jQuery modal popup Asp.Net

To use jQuery modal popup in Asp.Net we need to first add the jQuery reference on the page.

And next, you can create the dialog that will call the dialog box on a button click.

Step 1: Add the jQuery reference on your page or you can take the below reference file.

<script type="text/javascript" src=""></script>
<script src="" type="text/javascript"></script>

Step 2: Now we will create a method where you will add your dialog with the below option.

How to use jquery modal popup in
 function showmodalpopup() {
            width: 500,
            height: 250,
            modal: true,
            hide: { effect: 'drop', duration: 250 },
            resizable: false,
            draggable: false,
            position: "center",
            closeOnEscape: true

Step 3: Next, I added a Div where you can call this dialog using Div ID.

modal popup using jquery in c#
<div id="popupdiv" style="min-height: 0px;max-height: none;height: 230px;width: 500px!important;background: beige;text-align: center; display:none;" title="Success">
                           <b class="ResultSuccess"> 
                  <%=GetLocalResourceObject("lbResult") %></b>

Step 4: Here I have added a few CSS files which you can take as your reference to apply some style in your Popup.

jquery modal popup example
.ui-dialog-titlebar {
    background-color: #80c342;
    padding: 5px;
    color: white;
    height: 20px;
    font-weight: bold;
    font-size: 13px;
    width: 490px;
        font-weight: bold;
        font-size: 20px;
   .ui-dialog-titlebar-close {
    visibility: hidden;

Step 5: Now I am calling this showmodalpopup() from server-side after data successfully inserted in the table.

How to use jQuery modal popup in Asp.Net
 ScriptManager.RegisterStartupScript(this, GetType(), "Success", "showmodalpopup();", true);

In my submit button click, I called this method if my record inserted successfully. So once data inserted you will get a popup message like the below screenshot.

jquery modal popup c#

Here you can also add close button to close the dialog. So you need to add the below code.

jquery modal popup
buttons: {
                Close: function () {
jQuery modal popup in Asp.Net

You may like the following Asp.Net tutorials:

In this tutorial, we discussed how to use jQuery modal popup in Asp.Net.