I would suggest you to use
OnClientClick
Event.
So, the code would look like...
<asp:Button ID="btnClick" runat="server" Text="Click here" OnClick="btnClick_Click" OnClientClick="return ShowPopUp();" />
And update the JavaScript function as...
<script type="text/javascript">
function ShowPopUp() {
return confirm("Do you want to proceed? ");
}
</script>
So, when user would click
Ok
in confirm box, it would return you
true
, hence it will then fire the
Button Click Server Side Event. Otherwise, it would return
false
and stay as it is.