Andrea Azzola

Technology, Personal Development and Financial Independence

Using an ajax:ModalPopup Without a TargetControl

Posted on [Permalink]

The ModalPopup extender requires a control for firing up, that can be set through the TargetControlID property. However, sometimes you may want to show and hide the panel programmatically. All you need, is a fake activator like following:

<div id="divFakeActivator" runat="server" style="display: none" />

The Extender

<ajax:ModalPopupExtender ID="mpeInfo" runat="server" TargetControlID=" divFakeActivator " 
	PopupControlID="pnlInfo" CancelControlID="bttInfoClose" />

The Panel

<asp:Panel ID="pnlInfo" runat="server">
Hello World!!!

The C# code

// C#
Categories: AJAX