I think cancel button is causing postback.If you are using asp:button then change it to normal html button below
<asp:Panel runat="server" ID="popup" CssClass="panelStyle">
<input type="button" id="btnCancel" onclick="Cancel()" value="Cancel" />
</asp:Panel>
<script type="text/javascript">
function Cancel() {
$find("modalBehavior").hide();
}
</script>