Transfer.Server

Discussion in 'ASP .Net Web Controls' started by Gary Paquette, Jan 30, 2004.

  1. How to I launch a new browser window when using Transfer.Server (or with
    Response.Redirect)?
    Code goes from a linkButton to a function to validate and add parameters to
    the POST.

    I can do this from a hyperlink - using hyperlink.Target="_new" - but
    hyperlinks cannot support the external function.

    Help!
    Gary


    ------------------------------------------
    Gary Paquette
    Gary Paquette, Jan 30, 2004
    #1
    1. Advertising

  2. Hi Gary,

    Thanks for posting in the group. We are currently researching on this issue
    and will update your ASAP.

    If there is anything unclear, please feel free to post in the community and
    we will follow up.

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."
    Kevin Yu [MSFT], Jan 31, 2004
    #2
    1. Advertising

  3. Hi Gary,

    Thank you for posting in the community!

    Based on my understanding, when you click a link, you want to postback to
    server side(Do validation and pass parameters), which need LinkButton. But
    you did not figure out a way to open the navigation page in a new browser
    window.

    ==============================================
    For your passing parameters for POST, which page you want to POST to? POST
    to your server side or POST to the navigation page?

    I suppose you want to POST the web form data to your server side. (If I
    misunderstand you, please feel free to tell me)

    Asp.Net only encapsulate the client HTML and javascript code, so you still
    need client side support to open a new browser window.

    You can try the following 2 Solutions to see if it helps resolve your issue:
    1). Open your navigate window in <a>'s onclick client javascript

    First, add client javascript function:
    <script language=javascript>
    function navigation()
    {
    window.open("http://www.google.com");
    }
    </script>

    Then, Register <a>'s client onclick event handler:
    private void Page_Load(object sender, System.EventArgs e)
    {
    LinkButton1.Attributes.Add("onclick","navigation()");
    }

    2). Register client javascript code to open a new window in LinkButton's
    Server side click event:

    First, make <body> as server side control:
    <body runat=server id="bodycontrol">

    Then, register javascript in LinkButton's server click event:
    private void LinkButton1_Click(object sender, System.EventArgs e)
    {
    StringBuilder sb=new StringBuilder();
    sb.Append("<script language=javascript>");
    sb.Append("function navigation()");
    sb.Append("{\n");
    sb.Append("window.open(\"http://www.google.com\");");
    sb.Append("\n}");
    sb.Append("</script>");

    this.Page.RegisterClientScriptBlock("navigationscript",sb.ToString());
    bodycontrol.Attributes.Add("onload","navigation()");
    }

    ================================================
    Please apply my suggestion above and let me know if it helps resolve your
    problem.

    Thank you for your patience and cooperation. If you have any questions or
    concerns, please feel free to post it in the group. I am standing by to be
    of assistance.
    Have a nice day!!

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    Jeffrey Tan[MSFT], Feb 2, 2004
    #3
  4. Hi Gary,

    Does my reply make sense to you?

    If you still have anything unclear, please feel free to tell me, I will
    work with you.

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    Jeffrey Tan[MSFT], Feb 4, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adrian Bezzina
    Replies:
    0
    Views:
    510
    Adrian Bezzina
    Aug 7, 2003
  2. gh0st54
    Replies:
    6
    Views:
    8,025
    Natty Gur
    Aug 19, 2003
  3. ewolfman
    Replies:
    4
    Views:
    3,344
    ewolfman
    Feb 13, 2006
  4. JT

    Server.Transfer vs. Server.Execute

    JT, Sep 9, 2003, in forum: ASP General
    Replies:
    1
    Views:
    84
    Ray at
    Sep 9, 2003
  5. Jim
    Replies:
    1
    Views:
    847
    Aaron Bertrand - MVP
    Jan 28, 2004
Loading...

Share This Page