how to display PopUp with in poup using Ajax?


Step1: Code for Default.aspx page

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

<%@ 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”&gt;

<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head runat=”server”>
<title></title>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>

<asp:ScriptManager ID=”ScriptManager1″ runat=”server”/>

<cc1:ModalPopupExtender
ID=”ModalPopUpExtender”
runat=”server”
TargetControlID=”Button”
PopupControlID=”Panel1″
CancelControlID=”btnCancel” />

<cc1:ModalPopupExtender
ID=”ModalPopUpExtender1″
runat=”server”
TargetControlID=”Hidden1″
PopupControlID=”Panel2″
CancelControlID=”BtnCancel2″ />

<asp:Button
ID=”Button”
runat=”server”
Text=”Click Here”
onclick=”Button_Click” />

<br />

<asp:HiddenField ID=”Hidden1″ runat=”server” />
<br />

<asp:Panel ID=”Panel1″ BackColor=”Wheat”
runat=”server”
Height=”400px”
Width=”625px”
BorderColor=”blue”
BorderWidth=”10px”>

<asp:RadioButtonList
ID=”RadioButtonList1″
runat=”server”>

<asp:ListItem Value=”1″>Asp.net</asp:ListItem>

<asp:ListItem Value=”2″>C#</asp:ListItem>

<asp:ListItem Value=”3″>SQL Server</asp:ListItem>

</asp:RadioButtonList>

<br />

<asp:Button
ID=”btnCancel”
runat=”server”
Text=”Cancel” />

<asp:Button
ID=”Button1″
runat=”server”
Text=”ClickHere” onclick=”Button1_Click” />

</asp:Panel>

<asp:Panel ID=”Panel2″  BackColor=”AntiqueWhite”
runat=”server”
Height=”200px”
Width=”225px”
BorderColor=”blue”
BorderWidth=”10px”>

<br />
<b> This is the second popup</b><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
&nbsp;<asp:Button
ID=”BtnCancel2″
runat=”server”
Text=”Cancel” />

</asp:Panel>

</div>
</form>
</body>
</html>

Step2: Write this code in Code behind page

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

}
protected void Button_Click(object sender, EventArgs e)
{
ModalPopUpExtender.Show();
}
protected void Button1_Click(object sender, EventArgs e)
{
ModalPopUpExtender.Show();
ModalPopUpExtender1.Show();
}
}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.