Click here to Skip to main content
15,900,108 members
Articles / Web Development / HTML
Tip/Trick

Show Dialog Box Without Use of ModalPopupExtender

Rate me:
Please Sign up or sign in to vote.
4.85/5 (6 votes)
27 Nov 2014CPOL 12.3K   5  
Show dialog box with very few lines of code

Introduction

If you want to show Dialog box over your page, on click event of control, then you will use ModalPopExtender, which is Ajax Control, so instead of using this, I am giving one solution how to show Dialog box over Page which will be block Background, show title of Dialog Box, show message in Dialog Box.

Using the Code

CSS
    <style type="text/css">           
 
        .ui-dialog {            
            width: 400px !important;
            position: fixed;            
            height: 100%;
            display:block;
            z-index: 10;
            outline: 9999px solid rgba(0,0,0,0.5);
        }
       
    </style>
<asp:Panel ID="dialogPanel" 
runat="server" Visible="false" EnableViewState="false">

        <div id="dialogBox" title="VENTAS COSTES TOTAL INFORMACION"> 
        <%--información total de los costos de ventas--%>
            <p>
                <% =ViewState["dialogMessage"].ToString() %>
            </p>
        </div>
    </asp:Panel>

In .cs file , you need to enter these lines only on control click event:

C#
///<summary>
/// Shows the Dialog Box with message
///
private void ShowDialogBox()
{
string message= string.Empty();
message= "Here you can write what you want to display in Dialog Box";
ViewState["dialogMessage"] = message;
dialogPanel.Visible = true;
}

Points of Interest

Here, you do not need to worry about Close button click event , when you click on Close Image, Dialog Box disappears from the screen.

History

  • 27th November 2014: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --