473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

open a new window from code behind

i am developing a webform in which there is a preview button.On
pressing the button, I have to open a new window and display another
aspx page there.Can anyone tell me how to do it? Response.redirect
opens the new page in the same window.

Akshay

Feb 12 '06 #1
2 14615
There is no way to make ASP.NET open a new browser window. You can, however,
include dynamically generated Javascript code to open a new window with the
desired URL. The necessary information can be passed to this window using
whatever technique you want, including querystring, Session, etc. Opening
new windows is performed by the browser, so ASP.NET has no control over it.
However, keep in mind that many browsers have pop-up blockers that may
prevent Javascript from opening this new window (it will usually inform the
user and give them the option of opening it, but it waits for the user's
confirmation, so you should tell them why the browser will be trying to open
a new window). Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"akki" <ak*************@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
i am developing a webform in which there is a preview button.On
pressing the button, I have to open a new window and display another
aspx page there.Can anyone tell me how to do it? Response.redirect
opens the new page in the same window.

Akshay

Feb 12 '06 #2
Hi Akshay,

Here's a page in ASP.NET 2.0 that shows one way to accomplish what you need.
Let us know if it helps?

Ken
Microsoft MVP [ASP.NET[

<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Button1_Click _
(ByVal sender As Object, ByVal e As System.EventArgs)
ClientScript.RegisterStartupScript _
(Me.GetType, "popup", "window.open('" & _
TextBox1.Text & "','_blank','menubar=no')", True)
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Popup Demo</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:textbox id="TextBox1"
runat="server">http://www.kencox.ca/</asp:textbox><br />
<asp:button id="Button1" runat="server" onclick="Button1_Click"
text="Open" />&nbsp;</div>
</form>
</body>
</html>
"akki" <ak*************@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
i am developing a webform in which there is a preview button.On
pressing the button, I have to open a new window and display another
aspx page there.Can anyone tell me how to do it? Response.redirect
opens the new page in the same window.

Akshay

Feb 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Phillip Parr | last post by:
Hello, I have a nice system where someone clicks on a picture to show the full version. This pops up in a window.open box. It works great, the only problem is that if the user clicks a second...
8
by: J Gao | last post by:
Hi, experts, On a button click, I need to save some data to the session object. Then open a new window. The new window will use the session data saved in the first window. I don't want use to...
2
by: mg | last post by:
window.open (URLTarget, windowName, height=720,width=975,resizable=yes, ... lets me open a new WebForm with a specified size using JavaScript. Is there a way of doing this from code behind;...
5
by: Mark | last post by:
Hi all, how do I open a javascript window from a code behind page? I was using Response.Write("<script language='javascript'>window.open('url','name','options');</script>") but now for some...
2
by: Chris | last post by:
I know this is a dead horse I'm beating but why is it so impossible to ask for functionality in the HTML tag to open a window/page more controllable? why is: <a href="somepage.aspx?value1=xyz"...
2
by: carlor | last post by:
Hi there, I have a form that contains a link button. When the user clicks the link button I need to enable a couple of other buttons on the page and open a new browser window giving it focus...
8
by: Jeff User | last post by:
Hello all I am working on creating a Web application I am using C# code behind ..NET1.1 Rather than navigate to a new window, I want to open a seperate IE window when the user clicks a...
2
by: Ralf | last post by:
Using .NET 1.1, vb code behind. I have a project and I have been opening new windows throughout it. I need them opened on top of the parent, and be able to minimize or go back to the parent if...
6
by: bushi | last post by:
hi everyone! i have diplayed my hyperlinks in a iframe.when i redirect to next page.the next page also open in the same frame,but i want to open a new browser window,when i click on the...
3
by: | last post by:
Hello, I try to open a new Window in code behind with : ClientScript.RegisterClientScriptBlock(this.GetType(), "MyOpenScript", "window.open('toto.doc');", true); My problem is that the new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.