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

    ASP.net AJAX Modal Popup Control

    Helo Developers,

    I'm using ajax ModalPopupExtender in my code. After login i am calling another page in popup window. My problem is when i have complete the work on called page and then click the called page event and what to redirect the page to another page that page open in popup up window. But i want to open it in normal form. Below is my code for Login in design page and called page

    Login Page

    <ajaxToolkit:ModalPopupExtender ID="mp5" runat="server" PopupControlID="Panel1" TargetControlID="btnlogin"
    CancelControlID="btnClose" BackgroundCssClass="modalBackground">
    </ajaxToolkit:ModalPopupExtender>
    <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center" style = "display:none">
    <asp:ImageButton ImageAlign="Right" ID="btnClose" Width="32px" Height="32px" ImageUrl="~/images/Close.png" runat="server" />
    <iframe style=" width: 550px; height: 500px; border:0" id="irm1" src="Post_task.aspx" runat="server"></iframe>
    </asp:Panel>

    Post Task Page :

    <div style="text-align: left">
    <asp:Button ID="btn_Contine_Budget" Width="350px" runat="server" class="btn btn-default" Text="Get Quotes Now" OnClick="btn_Contine_Budget_Click" />
    </div>

    Post Task Code Page :

    protected void btn_Contine_Budget_Click(object sender, EventArgs e)
    {
    Response.Redirect("My_Task.aspx");
    }
  • #764488
    Hi Gaurav,
    on onClientClick of btnClose, write javascript function as follows:
    function CloseAndRedirect()
    {
    var url = "My_Task.aspx";
    var mytaskWindow = window.open(url, 'title', 'height=200,width=150');
    if (window.focus)
    { mytaskWindow.focus(); }
    }
    OR try to find "mp5" inside btn_Contine_Budget_Click() and write mp5.Hide(); before line Response.Redirect("My_Task.aspx");

    Hope it helps.
    Regards,
    Shashikant Gurav
    shashikantgurav22@gmail.com

  • #764492
    But how can i find mp5 bcoz my modal popup control is on login page and i am currently working on Post_task Page

  • #764524
    Hi,

    If you want to redirect to another page with popup then use below sample code.


    ScriptManager.RegisterStartupScript(this,this.GetType(),"Redirect",
    "alert('Redirection'); window.location='" +
    Request.ApplicationPath + "/NewPage.aspx';",true);

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

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #764533
    Hi Gaurav,
    Ok.. you can use jquery on Post Task Page as follows:
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript">
    $(function(){
    $('#btn_Contine_Budget').click(function() {
    window.close();
    window.open('My_Task.aspx');
    return true;
    });
    });
    </script>

    or you can write a javascript function on OnClientClick of btn_Contine_Budget button as follows:

    <script type="text/javascript">
    function Redirect()
    {
    window.opener.document.location.href="My_Task.aspx";
    this.close();
    }
    </script>
    Hope it helps.
    Regards,
    Shashikant Gurav
    shashikantgurav22@gmail.com


Sign In to post your comments