| Author: greeny_1984 03 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
Hi,
You can write a javascript function check this code
function confirmcode() {
if(confirm('Are you sure you want to quit')) { window.location.href="page2.aspx";
} else { window.location.href="previous.aspx"; }
}
Regards, Greeny_1984
Rate this Response[Excellent/Good/Poor] FRESHERS check this link Need help from me join here
|
| Author: Lakhan Pal 03 Nov 2009 | Member Level: Diamond | Rating:    Points: 6 |
Hi karunya -
In this Case you need to write a JavaScript Function and Use one hidden field to save the value for url.
For Example
<asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click" Text="SaveTransaction" OnClientClick="ConfirmAction();" /> <asp:HiddenField ID="hdnValue" runat="server">
function ConfirmAction() { var hdnValue= document.getElementById('<%=hdnValue.ClientID%>'); if(confirm('Are you sure you want to Save?')==true) { hdnValue.value="Ok"; } else hdnValue.value="Cancel"; }
cs Page Code: protected void btnSubmit_Click(object sender, EventArgs e) { if(hdnValue.value=="Ok") server.transfer ("FirstURL") else server.transfer ("SecondURL") }
Please rate this answer if it helped you. Thanks & Regards Lakhan Pal Garg Free Code Snippets
|
| Author: Anuraj 03 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
You need a javascript function for this
function showConfirm() { var result = confirm("Are you sure?"); if(result) { //Redirect to Page2 } else { //Redirect to Page2 } }
Thanks Anuraj THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS. BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT. dotnetthoghts
|
| Author: rajanigrandhi 04 Nov 2009 | Member Level: Gold | Rating:  Points: 2 |
function confirm(){if(confirm('Are you sure you want to quit')){window.location.href="page2.aspx";}else{window.location.href="previous.aspx";}}
|