Hi krupini,
Based on my understanding, you situation is there is a “X” sign as a close button in the PopupPanel, and the issue is could not find the way to hide the PopupPanel without post back, if I have misunderstood you, please feel free to tell me, thanks.
Actually, there are many way to hide the PopupPanel, and base on your request, we recommend using the hidePopup() function in the PopupControlBehavior.
Please refer to this sample code:
.aspx file
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestHidePopUp.aspx.cs"
Inherits="SoluTest_ModalOutsideUDP.TestHidePopUp" %>
<%@ 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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
/*Popup Control*/.popupControl
{
background-color: White;
position: absolute;
visibility: hidden;
}
.closeLabel
{
background-color: #666666;
color: #FFFFFF;
text-align: center;
font-weight: bold;
text-decoration: none;
border: outset thin #FFFFFF;
padding: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<cc1:PopupControlExtender ID="PopupControlExtender2" runat="server" DynamicServicePath=""
PopupControlID="Panel2" Enabled="True" ExtenderControlID="" TargetControlID="TextBox1"
CommitProperty="value" Position="Bottom" CommitScript="e.value += ' - do not forget!';">
</cc1:PopupControlExtender>
<asp:Panel ID="Panel2" runat="server" CssClass="popupControl">
<div style="border: 1px outset white; width: 100px">
<asp:UpdatePanel runat="server" ID="up2">
<ContentTemplate>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
<asp:ListItem Text="Walk dog" />
<asp:ListItem Text="Feed dog" />
<asp:ListItem Text="Feed cat" />
<asp:ListItem Text="Feed fish" />
<asp:ListItem Text="Cancel" Value="" />
</asp:RadioButtonList>
Whatever controls you could add here.
<asp:Label ID="btnClose" runat="server" onclick="ClosePopup()" Text="X" ToolTip="Close"
CssClass="closeLabel" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Panel>
</div>
</form>
<script type="text/javascript" language="javascript">
function ClosePopup(){
var pce = $find("PopupControlExtender2");
pce.hidePopup();
// var pop = $get("Panel2");
// pop.style.visibility="hidden";
}
</script>
</body>
</html>
.aspx.cs file
/// <summary>
/// Handler for radio button changes
/// </summary>
/// <param name="sender">source</param>
/// <param name="e">arguments</param>
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(RadioButtonList1.SelectedValue))
{
// Popup result is the selected task
PopupControlExtender2.Commit(RadioButtonList1.SelectedValue);
}
else
{
// Cancel the popup
PopupControlExtender2.Cancel();
}
// Reset the selected item
RadioButtonList1.ClearSelection();
}
And this is the hidePopup() function:
hidePopup : function() {
/// <summary>
/// Hide the popup
/// </summary>
this._popupBehavior.hide();
this._popupVisible = false;
AjaxControlToolkit.PopupControlBehavior.__VisiblePopup = null;
},
For more information, please refer to the files PopupControlBehavior.js and PopupControlExtender.cs, you can get the code from AjaxControlToolkit-Framework3.5.zip.
Please tell me whether it helps or not, thanks!
Best regards,
Zhi-Qiang Ni