Since you use the button only to execute client-side code, why you use the <asp:Button , instead, use plain HTML <input type="button" :
<form id="form1" runat="server"> <asp:Button ID="btnShow" runat="server" Text="Show" /> <asp:ToolkitScriptManager ID="scripManager" runat="server" /> <asp:ModalPopupExtender ID="modal" BackgroundCssClass="modalStyle" PopupControlID="popup" TargetControlID="btnShow" runat="server" BehaviorID="modalBehavior" /> <asp:Panel runat="server" ID="popup" CssClass="panelStyle"> <input type="button" id="btnCancel" onclick="Hide()" value="Cancel" /> </asp:Panel> </form> <script type="text/javascript"> function Hide() { $find("modalBehavior").hide(); } </script>
source share