Sunday, 11 November 2012

Simple Ajax Model Popup In Asp.net

Don't forget to add AjaxControlTool Kit ...then follow this code ..

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

<%@ 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></title>
    <style type="text/css">
        .modalBackground
        {
            background-color: #D65C33;
            filter: alpha(opacity=180);
            opacity: 0.8;
        }
        .modalPopup
        {
            background-color: #FFFFFF;
            border-width: 3px;
            border-style: solid;
            border-color: black;
            padding-top: 10px;
            padding-left: 10px;
            width: 300px;
            height: 140px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="SM" runat="server">
        </asp:ScriptManager>
        <asp:Button ID="btnShow" runat="server" Text="Show Modal Popup" title="Click to show popup"
            OnClick="btnShow_Click" />
        <cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panel" TargetControlID="btnShow"
            CancelControlID="imgclose" BackgroundCssClass="modalBackground">
        </cc1:ModalPopupExtender>
        <asp:Panel ID="Panel" runat="server" CssClass="modalPopup" align="center" BorderColor="#000099"
            BorderWidth="5px" Style="display: none">
            <asp:Image runat="server" ID="imgclose" ImageUrl="~/download.jpg" Style="margin-left: 260px;"
                title="Close" />
            <asp:Label runat="server" ID="lblPop" Text="This is Ajax Model Popup Created By Sajil"></asp:Label>
        </asp:Panel>
    </div>
    </form>
</body>
</html>



No comments:

Post a Comment