Question
I have a modal pop up that comes up when a hyperlink is clicked.. now i want to add a button withing the modal pop up to close it.. but i am not sure how to., i tried this
<ajaxToolKit:ModalPopupExtender ID="mPopup" runat="server" TargetControlID="HyperLink"
PopupControlID="pnlItem" BackgroundCssClass="modalBackground" />
<asp:Panel runat="server" ID="pnlItem" Style="display: none;" CssClass="PopupStyle" Width="400">
<div>
<ucc:High ID="High" runat="server" />
<asp:Button ID="btnClose" runat="server" Text="CLOSE"
OnClientClick="javascript:document.getElementById('btnClose').click();return false;" />
</div>
</asp:Panel>
But its not working.. it throws js script issues.
Any help would be much appreciated
Solution
There is a property called CancelControlID. More explanation is available at http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ModalPopup/ModalPopup.aspx
OTHER TIPS
<ajaxToolKit:ModalPopupExtender ID="mPopUp" CancelControlID="btnClose" runat="server" TargetControlID="HyperLink2"
PopupControlID="pnlItem" BackgroundCssClass="modalBackground" />
<asp:Panel runat="server" ID="pnlItem" Style="display: none;" CssClass="PopupStyle"
Width="400">
<div>
<ucc:High ID="High" runat="server" />
<asp:Button ID="btnClose" runat="server" Text="Close" OnClientClick="javascript:document.getElementById('btnClose').click();return false;" />
</div>
</asp:Panel>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow