You must Sign In to post a response.
  • Category: ASP.NET

    Redirect a page after viewing alertmessage

    i have 2 pages (login page and registration page)
    i want to go back login page after registration page is filled
    after submitting the registration page showing a successfully alert and then only want to redirect login page
  • #767382

    To call Javascript alert from Codebehind and then redirect to other page

    ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Hi", "alert('This is popUpMessage');", true);


    CleintScript.RegisterStartupScript(this.GetType(),"key","<script type='text/javascript'>alert("This is popUpMessage")</script>")

    Hope this will help you

    Never lose hope..You never know what tomorrow will bring

  • #767383

    Use AJAX Modal popup extender for showing popup alert when you click Ok that time you just redirect to some other page and hide the pop up.


    <asp:Button ID="btnSubmit" Text="Submit" runat="server" />
    <cc1:ModalPopupExtender ID="mpe" runat="server" TargetControlID="btnSubmit"
    PopupControlID="pnlPopup" BackgroundCssClass="modalBackground">

    <asp:Panel ID="pnlPopup" runat="server" >
    <table width="100%" >

    <td align="right" style="padding-right: 15px">
    <asp:UpdatePanel ID="upCancel" runat="server" UpdateMode="Always">
    <asp:Button ID="btnYes" OnClick="btnYes_Click" runat="server"/>
    <asp:AsyncPostBackTrigger ControlID="btnCancelYes" EventName="Click" />

    and btnYes click event just hide your modal and submit the form details to your database and then redirect to your login page

    protected void btnYes_Click(object sender, EventArgs e)
    //submit for data into database

    Hope this will helpful to you....

    Refer below link if you want to know more details about modalpopup

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #767410
    Hi krishna ,

    i am also face this same like you problem somedays ago
    here is solution Am using

    string display = "Your Password has been Updated Successfully";
    ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('" + display.ToString() + "'); window.location='" + Request.ApplicationPath + "Default.aspx';", true);

    Default.aspx or give your required page url.
    just use my code it will works


  • #767449
    After you page registration you have to register the javascript. That should show the alert message and also redirect the page. Place the script register as follows after registration completed

    Page.ClientScript.RegisterStartupScript(this.GetType(), "RegSucessScript", "RegSucessfully();", true);

    They right the java script in you aspx page as follows.

    function RegSucessfully() {
    alert("Registered Sucessfully");
    this.window.location.href = 'YourRedirectPage.aspx'

    By Nathan
    Direction is important than speed

Sign In to post your comments