Open Multiple New Browser Windows from ASP.NET
I'm having trouble figuring out how to open multiple new browser windows
(each one displaying something different). As you can see from the code
below, I have one ASP.NET page that has a foreach loop, and inside this
foreach loop, I was to spawn a new browser window using the second ASP.NET
page.
This doesn't work. Only the last time through the foreach loop causes a new
browser window to open. All other times through the loop don't open a new
browser window.
Would any one know how to make this work?
Page1.aspx
protected void LinkButtonGenerateMyGroup_Click(object sender, EventArgs e)
{
int i = 0;
string from = ...;
string to = ...;
...
foreach (someobject in someobjects)
{
string sKey = "GenerateReport" + i.ToString();
string sScript = System.String.Empty;
i++;
// Tried but doesn't work
//sScript =
"window.open('Page2.aspx?from=MyGroups&usedates=tr ue&fromdate=" + from +
"&todate=" + to + "', '" + sKey + "',
'copyHistory=no,directories=no,location=no,menubar =no,resizable=yes,scrollba
rs=yes,status=no,toolbar=no');";
//Page.ClientScript.RegisterClientScriptBlock(this.G etType(), sKey,
sScript, true);
// Tried but doesn't work
//sScript =
"<script>window.open('Page2.aspx?from=MyGroups&use dates=true&fromdate=" +
from + "&todate=" + to + "', '" + sKey + "',
'copyHistory=no,directories=no,location=no,menubar =no,resizable=yes,scrollba
rs=yes,status=no,toolbar=no');</script>";
//Response.Write(sScript);
}
}
Page2.aspx
protected void Page_Load(object sender, EventArgs e)
{
...
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AppendHeader("content-length", result.Length.ToString());
Response.ContentType = "Application/pdf";
Response.BinaryWrite(result);
Response.Flush();
Response.Close();
} 1 3460
Here's a little more info.
Basically, I want the client-side JavaScript to execute, thereby opening the
new browser with Page2.aspx. Then, I want Page2's load event to fire.
Then, I want the next browser window to open and again fire Page2's load
event. And so on and so forth until the foreach loop in Page1.aspx is
complete.
Any help would be greatly appreciated.
Thanks!
"dnes" <no****@company.comwrote in message
news:eK**************@TK2MSFTNGP04.phx.gbl...
Open Multiple New Browser Windows from ASP.NET
I'm having trouble figuring out how to open multiple new browser windows
(each one displaying something different). As you can see from the code
below, I have one ASP.NET page that has a foreach loop, and inside this
foreach loop, I was to spawn a new browser window using the second ASP.NET
page.
This doesn't work. Only the last time through the foreach loop causes a
new
browser window to open. All other times through the loop don't open a new
browser window.
Would any one know how to make this work?
Page1.aspx
protected void LinkButtonGenerateMyGroup_Click(object sender, EventArgs e)
{
int i = 0;
string from = ...;
string to = ...;
...
foreach (someobject in someobjects)
{
string sKey = "GenerateReport" + i.ToString();
string sScript = System.String.Empty;
i++;
// Tried but doesn't work
//sScript =
"window.open('Page2.aspx?from=MyGroups&usedates=tr ue&fromdate=" + from +
"&todate=" + to + "', '" + sKey + "',
'copyHistory=no,directories=no,location=no,menubar =no,resizable=yes,scrollba
rs=yes,status=no,toolbar=no');";
//Page.ClientScript.RegisterClientScriptBlock(this.G etType(),
sKey,
sScript, true);
// Tried but doesn't work
//sScript =
"<script>window.open('Page2.aspx?from=MyGroups&use dates=true&fromdate=" +
from + "&todate=" + to + "', '" + sKey + "',
'copyHistory=no,directories=no,location=no,menubar =no,resizable=yes,scrollba
rs=yes,status=no,toolbar=no');</script>";
//Response.Write(sScript);
}
}
Page2.aspx
protected void Page_Load(object sender, EventArgs e)
{
...
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AppendHeader("content-length", result.Length.ToString());
Response.ContentType = "Application/pdf";
Response.BinaryWrite(result);
Response.Flush();
Response.Close();
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marshall Dudley |
last post by:
When I do the following line in Netscape, the popup loads as it should,
but the parent window usually, but not always, reloads as well.
<a href="#"...
|
by: David McCulloch |
last post by:
The following code opens a new window, but the "resizeTo" doesn't resize it.
Why not?
(Don't ask why I simply did not open the window with the new size....my
original problem was how to open a...
|
by: Ian Sedwell |
last post by:
Hi guys
The following code works just fine in Netscape on MacOS and Windows. But in
Explorer on MacOS and Windows it throws a type mismatch error at the point
marked with the comment ³// bug out...
|
by: nntp |
last post by:
Are there other ways to open multile windows at once?
<SCRIPT language="JavaScript">
function open1() {
var open1 =
window.open('http://google.com/CheckEnviro.pl','','scrollbars=yes,height=600...
|
by: google |
last post by:
Hi there,
I've searched high and low for this, but it seems most people are
looking to establish (and control) the relationship between a parent
browser window and it's associated child window...
| |
by: Ayoa |
last post by:
I am working on some web based custom reports and i want to open multiple
browser at the click of a button. So for example if i have 2 guids in my
arraylist, i want to open 2 windows.
protected...
|
by: DaveC |
last post by:
Hi,
If I set up a link to take my viewers away from my site, how can I force
their browser to open a second copy? Idea, of course, is to bring viewers
back into my site when they close the 2nd...
|
by: Geoff Fox |
last post by:
I am in the final moments of designing a new website. One of the pages
(http://www.auditionfactory.com/samples.php) has four links to show
sample work. I would like these links to open new...
|
by: =?Utf-8?B?YzY3NjIyOA==?= |
last post by:
Hi all,
I am thinking about doing this since I got several cases that some of our
internal users open more than one browser at the same time from our server.
When one of the transactions was not...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |