Hello, I have a problem with ModalPopupExtender.
When the user changes the value of cbShow the popup panel (pnl1) closes. When I reopen it I get to see the changes. For example, if the user checked the cbShow then pnl2 is visible.
If I don't set the AutoPostBack property to true then my code does not work and nothing happens on ChangedValue.
Any kind of help would be appreciated, thank you.
Here's my code:
<asp:ModalPopupExtender ID="popup" TargetControlID="lnkFake" CancelControlID="btnCancel"
PopupControlID="pnl1" BackgroundCssClass="modalBackground" DropShadow="true"
runat="server">
</asp:ModalPopupExtender>
<asp:Panel ID="pnl1" runat="server">
<div>
<table class="mGrid">
<tr>
<td >
<asp:CheckBox ID="cbShow" runat="server" Autopostback="true"
Text="Show panel: "
TextAlign="Left" OnCheckedChanged="cbShow_CheckedChanged" />
</td>
</tr>
</table>
<br />
<asp:Panel ID="pnl2" runat="server" Visible="false">
<asp:Label ID="Label1" runat="server" Text="Show the panel"></asp:Label>
</asp:Panel>
<br />
</div>
<div>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</div>
</asp:Panel>
protected void cbShow_CheckedChanged(object sender, EventArgs e)
{
if (cbShow.Checked == true)
pnl2.Visible = true;
else
pnl2.Visible = false;
}