Friday, September 10, 2010

Example on creating the Ajaxmodal popup extender dynamically

by Narendra, .Net Developer

<html xmlns="">
<head runat="server">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:Panel ID="pnlcreatemodal" runat="server">

<asp:Label ID="lblexmsg" Text="Example on creating the Ajaxmodal popup extender dynamically"></asp:Label>
<br />

<asp:Button ID="btncreatemodal" runat="server" Text="Click here to Create Modal PopUp" onclick="btncreatemodal_Click" />

<asp:Panel ID="pnlclosemodal" runat="server" Style="display: none" BackColor="Gray">
Dynamic Modal PopUp
<asp:Button ID="btnClosemodalpopup" runat="server" Text="Click here to Close ModalPopUp " />

protected void Page_Load(object sender, EventArgs e)


protected void btncreatemodal_Click(object sender, EventArgs e)

// Creating the button dynamically when clicking the button (btncreatemodal)
Button btn1 = new Button();

btn1.ID = "btn";

btn1.Text = "Click Here to Show Modal PopUp";

// Creating the modal popup dynamically when clicking the button (btn)
AjaxControlToolkit.ModalPopupExtender modalPop = new AjaxControlToolkit.ModalPopupExtender();
modalPop.ID = "popUp";
modalPop.PopupControlID = "pnlclosemodal";
modalPop.TargetControlID = "btn";
modalPop.CancelControlID = "btnClosemodalpopup";



No comments:

Post a Comment