473,788 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP: Spawning Multiple Browsers Using RegisterClientS criptBlock

Hi All,
We have an ASP.NET 2.0 (C#) intranet application that needs to spawn multiple browsers using RegisterClientS criptBlock. Here's what we got so far:

// Go thru each datarow in the datatable
foreach (System.Data.Da taRow drReportGroupsD etails in tableReportGrou psDetails.Rows)
{
// Get the needed values from the datatable
string reportName = (string)drRepor tGroupsDetails["ReportName "];
string reportPath = (string)drRepor tGroupsDetails["ReportPath "];

// Do other work ...

// Build the URL - NOTE: The reportName and reportPath variables are different each time thru the loop
url = "http://localhost/..." + reportName + "..." + reportPath + "...";

// Build the javascript to display the message
sScript = "<script language=\"java script\" type=\"text/javascript\">wi ndow.open(\"" + url + "\", \"GenerateRepor t\", \"height=675,wi dth=975,left=0, top=0,copyHisto ry=no,directori es=no,location= no,menubar=no,r esizable=no,scr ollbars=no,stat us=no,toolbar=n o\");</script>";

// Execute the script
Page.ClientScri pt.RegisterClie ntScriptBlock(t his.GetType(), "GenerateReport ", sScript);
}
So, we have a method that iterates through a set of rows in a datatable, builds a URL, builds the JavaScript to open a new window (using window.open), and then executes the script using Page.ClientScri pt.RegisterClie ntScriptBlock.

The problem is that only one browser is popped-up. It's for the last row in the datatable.

How can we pop-up a new browser instance for each row in the datatable?

Thanks.

Mar 14 '06 #1
2 2823
Give the script blocks unique names. It looks like the name is always GenerateReport - so it keeps overwriting the last script, and you end up with the very last one.

If you look at the documentation for RegisterClientS criptBlock it says:
A client script is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. Only one script with a given type and key pair can be registered with the page. Attempting to register a script that is already registered does not create a duplicate of the script.

Call the IsClientScriptB lockRegistered method to determine whether a client script with a given key and type pair is already registered and avoid unnecessarily attempting to add the script.
Give the scripts unique names. For example, use an integer that you increment to create script names like GenerateReport0 , GenerateReport1 , etc.
"kewl" <no****@company .com> wrote in message news:et******** ******@tk2msftn gp13.phx.gbl...
Hi All,
We have an ASP.NET 2.0 (C#) intranet application that needs to spawn multiple browsers using RegisterClientS criptBlock. Here's what we got so far:

// Go thru each datarow in the datatable
foreach (System.Data.Da taRow drReportGroupsD etails in tableReportGrou psDetails.Rows)
{
// Get the needed values from the datatable
string reportName = (string)drRepor tGroupsDetails["ReportName "];
string reportPath = (string)drRepor tGroupsDetails["ReportPath "];

// Do other work ...

// Build the URL - NOTE: The reportName and reportPath variables are different each time thru the loop
url = "http://localhost/..." + reportName + "..." + reportPath + "...";

// Build the javascript to display the message
sScript = "<script language=\"java script\" type=\"text/javascript\">wi ndow.open(\"" + url + "\", \"GenerateRepor t\", \"height=675,wi dth=975,left=0, top=0,copyHisto ry=no,directori es=no,location= no,menubar=no,r esizable=no,scr ollbars=no,stat us=no,toolbar=n o\");</script>";

// Execute the script
Page.ClientScri pt.RegisterClie ntScriptBlock(t his.GetType(), "GenerateReport ", sScript);
}
So, we have a method that iterates through a set of rows in a datatable, builds a URL, builds the JavaScript to open a new window (using window.open), and then executes the script using Page.ClientScri pt.RegisterClie ntScriptBlock.

The problem is that only one browser is popped-up. It's for the last row in the datatable.

How can we pop-up a new browser instance for each row in the datatable?

Thanks.

Mar 14 '06 #2
also for this to work, your clients will have to allow popups in their browser.

-- bruce (sqlwork.com)

"Marina Levit [MVP]" <so*****@nospam .com> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Give the script blocks unique names. It looks like the name is always GenerateReport - so it keeps overwriting the last script, and you end up with the very last one.

If you look at the documentation for RegisterClientS criptBlock it says:
A client script is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. Only one script with a given type and key pair can be registered with the page. Attempting to register a script that is already registered does not create a duplicate of the script.

Call the IsClientScriptB lockRegistered method to determine whether a client script with a given key and type pair is already registered and avoid unnecessarily attempting to add the script.
Give the scripts unique names. For example, use an integer that you increment to create script names like GenerateReport0 , GenerateReport1 , etc.
"kewl" <no****@company .com> wrote in message news:et******** ******@tk2msftn gp13.phx.gbl...
Hi All,
We have an ASP.NET 2.0 (C#) intranet application that needs to spawn multiple browsers using RegisterClientS criptBlock. Here's what we got so far:

// Go thru each datarow in the datatable
foreach (System.Data.Da taRow drReportGroupsD etails in tableReportGrou psDetails.Rows)
{
// Get the needed values from the datatable
string reportName = (string)drRepor tGroupsDetails["ReportName "];
string reportPath = (string)drRepor tGroupsDetails["ReportPath "];

// Do other work ...

// Build the URL - NOTE: The reportName and reportPath variables are different each time thru the loop
url = "http://localhost/..." + reportName + "..." + reportPath + "...";

// Build the javascript to display the message
sScript = "<script language=\"java script\" type=\"text/javascript\">wi ndow.open(\"" + url + "\", \"GenerateRepor t\", \"height=675,wi dth=975,left=0, top=0,copyHisto ry=no,directori es=no,location= no,menubar=no,r esizable=no,scr ollbars=no,stat us=no,toolbar=n o\");</script>";

// Execute the script
Page.ClientScri pt.RegisterClie ntScriptBlock(t his.GetType(), "GenerateReport ", sScript);
}
So, we have a method that iterates through a set of rows in a datatable, builds a URL, builds the JavaScript to open a new window (using window.open), and then executes the script using Page.ClientScri pt.RegisterClie ntScriptBlock.

The problem is that only one browser is popped-up. It's for the last row in the datatable.

How can we pop-up a new browser instance for each row in the datatable?

Thanks.

Mar 14 '06 #3

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

Similar topics

6
7723
by: Rolf Wester | last post by:
Hi, I have a form with a select element with multiple="true". When using the GET method (I suppose the same happens with the POST method) I can seen that the form sends channels=CH1&channels=CH2 when CH1 and CH2 have been choosen. $_GET gives me "CH2". Is there any way to get all the choosen channels elements? I would be very appreciative for any help. Thank you in anticipation. Regards
9
4414
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with the microsoft HTML workshop utility, lets call it c:\path\help.chm. My question is how do you launch it from the GUI? What logic do I put behind the "help" button, in other words. I thought it would be os.spawnv(os.P_DETACH,...
0
1506
by: ST Wong | last post by:
Hi all, I'm new to MySQL. I installed 4.0.16 on an old RedHat (7.1). Everything is okay except that 10 of mysqld daemons are started instead of 1. I checked start up options but can't find the solution. Is this normal and can I change this behaviour ? Would anyone please help? Thank you very much.
29
4650
by: Paul | last post by:
Hi, I'd like to limit the number of selections a user can make in a multiple select listbox. I have a note on the interface to say that only x no. of items should be selected and I check the number server side but I'd like to implement some javascript to do the same on the client side. Ideally I'd like the javascript to work in IE5+ and Netscape6+. Thanks,
2
4900
by: Margaret Werdermann | last post by:
Hi all: I'm having a nasty time with a particularly difficult piece of code and was hoping someone might be able to help me. I have a FormMail form that originally worked perfectly. Then, I had to add a JavaScript function to the Submit button to make a server function run when the form was submitted. Unfortunately, this JavaScript wouldn't run when the button was designated as a Submit, so I changed the button and placed a...
2
2643
by: Dave Kirby | last post by:
I am working on a network management program written in python that has multiple threads (typically 20+) spawning subprocesses which are used to communicate with other systems on the network. This runs fine for a while, but eventually slows down to a crawl. Running sar shows that when it is running slowly there is an exceptionally large number of minor page faults - there are continuously 14000 faults/sec, with a variation of about...
2
1988
by: Steve K | last post by:
I got a bit of a problem I like some help on. I'm designing an online training module for people that work in food processing plants. This is my target audience. These workers have little or no computer knowledge at all! And they also have outdated, old browsers, slow modems, old computers, etc. So I need to keep this as simple as possible and as browser compatible as possible. The client wants a navigation bar at the bottom of each...
1
3478
by: dnes | last post by:
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...
3
1142
by: Andy B | last post by:
I am creating a CSS layout and need to test it with different browsers. I have the framework for the layout done with contrasting colors for each section. Can anybody if possible, go to www.test.eternityrecords.org/index2.aspx and look at the design? Tested browsers need to be Safari 3 +, IE5+ including IE8 and Firefox 2+. After you go to the page, send your comments about whether the layout looks good or not and what's wrong with it along...
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10173
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
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 we have to send another system
2
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.