Transfer.Server

G

Gary Paquette

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
 
K

Kevin Yu [MSFT]

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."
 
J

Jeffrey Tan[MSFT]

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.
 
J

Jeffrey Tan[MSFT]

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top