Reputation: 4524
Script
<script language="javascript" type="text/javascript">
function FinalFunction() {
//Your First Script
return confirm('Are you sure about to submit the test?');
}
</script>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:FinalFunction();" OnClick="Button1_Click" />
This script is showing the confirmation alert message but either on clicking OK or Cancel Button, the page is redirecting to another page.
What I want is when I click on the Cancel Button, the page should be on same page, it should not redirect to another page.
How do I do it?
Upvotes: 0
Views: 626
Reputation: 2053
The button does a postback, do you redirect to another page in your .NET code-behind class?
Upvotes: 0
Reputation: 12395
modify your function:
function FinalFunction() {
confirm('xxx');
return false;
}
but when would you like to redirect your page?
Upvotes: 0