Step 1: - Right Click on Project Root folder => Click on Manage NuGet Packages… => Search Ajax in search box and Select AjaxControlToolkit from list =>
Click on Install button
Step 2: - Add AjaxModalPopupExtender.aspx Web Form page in project
Step 3: - AjaxModalPopupExtender.aspx design
Page Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AjaxModalPopupExtender.aspx.cs" Inherits="AjaxControls.AjaxModalPopupExtender" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
.modalBackground {
background-color: #000000;
opacity: 0.7;
}
.modalPopup {
border: 1px solid #2F4F4F;
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 runat="server">
</asp:ScriptManager>
<asp:Button ID="btnShow" runat="server" Text="Show
Modal Popup" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1"
TargetControlID="btnShow" CancelControlID="btnClose" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center" Style="display: none">
Your Content Here
<br />
<br />
<asp:Button ID="btnOK" runat="server" Text="Ok" OnClick="btnOk_Click" />
<asp:Button ID="btnClose" runat="server" Text="Close" />
</asp:Panel>
<br />
</div>
</form>
</body>
</html>
Step 4: - Code behind Page Code
using System;
namespace AjaxControls
{
public partial class AjaxModalPopupExtender : System.Web.UI.Page
{
protected void
Page_Load(object
sender, EventArgs e)
{
}
protected void
btnOk_Click(object
sender, EventArgs e)
{
Response.Write("<script>alert('You Click OK')</script>");
}
}
}
Step 5: - Output
Nice post. Keep updating Tableau Online Training
ReplyDeleteAWS Online training
Dot Net OnlineTraining
DevOps Online Training
Selenium Online Training