Click here to Skip to main content
15,436,185 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" language="javascript">
function confirmsave()
{
var ans = confirm('Do u want to Save?');
if (ans == true) {
window.location.href="/KB/answers/login.aspx", true;
}
else {
return false;
}
}


</script>
</head>
<body>
<form id="form1" runat="server">

<asp:Label ID="lbl1" Text="" runat="server">

<asp:FileUpload ID="FU1" runat="server"/>

<asp:Button ID="btnsubmit" Text="Upload" runat="server" onClientClick="return confirmsave();" />

</form>
</body>
</html>
Posted
Updated 8-Sep-16 0:30am
Comments
Richard C Bishop 14-Feb-14 13:42pm    
I don't think you need ".href" after the "window.location". Try that and let me know.

Try the following.
JavaScript
window.location.href = 'login.aspx';

It assumes that this page exist in the same folder as of the caller page.
 
Share this answer
 
C#
function confirmsave()
{
var ans = confirm('Do u want to Save?');
if (ans == true) {document.location.href='login.aspx',true}
else {
return false;
}
}


works......:)
 
Share this answer
 
setTimeout(function(){document.location.href = "page.html;"},500);
it will work in all browser.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900