Click here to Skip to main content
15,902,032 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in new user registration form,after filling up the details,when i click the submit button,a confirm box should appear with text as "thank you for registering and do u wish to login now?" and with 2 buttons like yes and no...if i click yes it should redirect to the respective .apx page which i specify...help me with this please...soon..thanks in advance
Posted

Check this to show the confirm box http://www.w3schools.com/js/js_popup.asp[^]
and this to redirect to webpage using javascript http://www.tizag.com/javascriptT/javascriptredirect.php[^]
 
Share this answer
 
Comments
nityasri 1-Nov-12 0:48am    
thank you
Try following links in CP:
how to generate alert & confirm box in ASP .Net[^]
confirm-alert-box-in-javascript-and-asp-net[^]
http://forums.asp.net/t/1405893.aspx/1[^]

Or an example below:
JavaScript
<script type="text/javascript" language="javascript"> 
        function ConfirmOnDelete() 
        { 
          if (confirm("Are you sure?")==true) 
            return true; 
          else 
            return false; 
        } 
    </script> 

ASP.NET
<asp:button id="Button1" runat="server" text="Button" onclick="Button1_Click" onclientclick="return ConfirmOnDelete();" xmlns:asp="#unknown" />
 
Share this answer
 
You can this code in asp button
HTML
OnClientClick="return confirm('thank you for registering and do u wish to login now?')"


if user clicks yes then it returns true and server event executes then redirect to your respective.aspx in button_click event.

Or if you want to do it by JavaScript itself then call

OnClientClick="fnConfirm()"

C#
function fnConfirm() {
            if (confirm('thank you for registering and do u wish to login now?')) {
                window.location = "http://www.your-new-location.com/respective.aspx";
//or
    //"window.open('respective.aspx');
            }
            else {
                return false;
            }
        }
 
Share this answer
 
v2
Comments
nityasri 1-Nov-12 5:49am    
but i use validate function(like phone number checking) also in this registration form ..so if i click submit button will the validate function will be carried out or the confirm box function will be carried out?..please help me knw ...
SoumenBanerjee 1-Nov-12 6:04am    
yes for that you have to change onclientclick as

OnClientClick="if (Page_ClientValidate()){ return confirm('thank you for registering and do u wish to login now?')}"

This will first validate then if page validation succeed then call confirm box otherwise show only validation error message.
nityasri 1-Nov-12 11:01am    
@soumen...thanks a lot

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



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