AJAX PopupControl Extender

Updated on 19 Apr 2012,
Published on 30 May 2008

The AJAX PopupControlExtender provides a new and very interactive way to display the collection of list type options using different ASP.Net controls. Instead of using drop downs or list boxes you can use PopupControlExtender to display the collection of options in any other ASP.Net server control e.g.: radio button list, checkbox list etc...

AJAX Control Toolkit Examples:

You can see the live samples and examples of AJAX Control Toolkit from the following links:

You can display the popup populated with values retrieved from the database and set the value for targeted Textbox by selecting a value from the popup. All this functionality can be provided with more interactive way using AJAX UpdatePanel. UpdatePanel will bind and update the values using Partial Rendering feature of AJAX that works for individual controls without affecting rest of web page.

PopupControlExtender controls both server side and client side events based on the values specified in its properties.

PopupControl Extender Properties

TargetControlID: ID of the textbox that will capture the return values.

PopupControlID: ID of the control that will appear as popup.

Position: You can specify the position for the popup to appear. It accepts the positions as Bottom, Top, Center, Left and Right.

OffesetX: It assigns margin to the popup in horizontal direction from the position defined in Position property.

OffsetY: It assigns margin to the popup in vertical direction corresponding to the specified Position.

CommitProperty: It adds a new attribute/property to the target control that you can access and use at client side scripting.

CommitScript: Client side script that executes after retrieving the popup value.

Sample Code for PopupControlExtender

CSS code
.popupControl {
    background-color: #eeeeee;
    border: outset 1px #c0c0c0;
    color: #444444;
    position: absolute;
    visibility: hidden;

.textbox {
    border: solid 2px #cccccc;
    border-top: solid 2px #a0a0a0;
    color: #444444;
    width: 250px;
<asp:ScriptManager ID="ScriptManager1" runat="server">

<asp:Label ID="Label1" 
    Text="Click inside the textbox to open AJAX Popup Control:">

<div class="clear"><br /></div>

<asp:TextBox ID="TextBox1" 

<asp:Panel ID="Panel1" runat="server" CssClass="popupControl">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <asp:RadioButtonList ID="RadioButtonList1" 
                <asp:ListItem Value="#ff0000">Red</asp:ListItem>
                <asp:ListItem Value="#0000ff">Blue</asp:ListItem>
                <asp:ListItem Value="#00ff00">Green</asp:ListItem>
                <asp:ListItem Value="#c0c0c0">Gray</asp:ListItem>

<ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" 
    CommitScript="e.style.color = e.foreColor;e.value = e.foreColor + ' - is your selected color';" 
C# Code
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)


Above sample code will help you to learn the use of CommitProperty and CommitScript property of the PopupControlExtender.


You can see the output of above discussed code from the following link:

AJAX Popup Control

Continue to next tutorial: AJAX Resizable Control Extender to learn the AJAX functionality to resize the ASP.Net Panel control.

1 Responses to "AJAX PopupControl Extender"
Really helpful. Thanks
Leave a Comment
* required
* required
* will not be published
* optional
* hint: http://www.example.com
  • Subscribe via Email