Thursday, March 15, 2012

ModalPopup Extender example in Asp.Net c#




************************************************************************

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ModalPopup Extender example in Asp.Net c#</title>
    <style type="text/css">
    .modalBackground
    {
        background-color: Black;
        filter: alpha(opacity=70);
        opacity: 0.7;
        z-index: 0;
    }
    .PnlPopUp
    {
        width:500px;
        height:700px;
        background:#ffffff;
        margin:5px;
        border:2px solid #cacac2;
        padding:2px;
        z-index: 1;
    }
 
    .CloseDialog
    {
        float:left;
        margin-left:3px;
        background: url(./red.png) no-repeat top;
        z-index: 1;
        cursor:pointer;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
    <h2> ModalPopup Extender example</h2>
    <p>
        <asp:Button ID="Button1" runat="server" Text="Popup" />
        <cc1:ModalPopupExtender
            ID="Button1_ModalPopupExtender"
            runat="server"
            BackgroundCssClass="modalBackground"
            Enabled="True"
            TargetControlID="Button1"
            PopupControlID="pnlPopUp">
        </cc1:ModalPopupExtender>
    </p>

    <asp:Panel runat="Server" ID="pnlPopUp" CssClass="PnlPopUp" Style="display:none;">
    <asp:ImageButton
    ID="ClosePopUp"
    ImageUrl="~/red.png"
    runat="server"
    CssClass="CloseDialog"
    style="float:right"/>
 
    </asp:Panel>
 
    </div>
    </form>
</body>
</html>

************************************************************************

using System;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
************************************************************************

Post a Comment