472,340 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Open new window in codebehind and add the window handle to javascript array

RJN
Hi

In the mainscreen I have a datagrid and from here I open new windows on
click of link button. And I'm doing it through RegisterStartupScript

Me.RegisterStartupScript("PopUp", _
"<script language='JavaScript'> " & _
"var winOp = window.open('MyScreen.aspx', 'test');" + _
"if (winOp != null) winOp.focus();" + _
"</script>")

I want to keep track of the windows that are opened and add the window
handles to a javascript array whenever a new window is opened in the
codebehind. In the .aspx page I should be able to access this array.

var winArray = new Array;// populated in .aspx.vb
function test()
{
for(i=0;i<winArray.length;++i)
alert(winArray[i].name);
}

Is there a way to do this?Can this be done through
Page.RegisterArrayDeclaration?
Thanks

rjn

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
1 2765
Since the window isn't opened until the response is renedered on the client,
you can't get hold of that handle on the server side.

Add JavaScript code to add the window handle to the array on the client side
when the window is opened instead.

--
Patrik Löwendahl [C# MVP]
www.cshrp.net - "Elegant code by witty programmers"

"RJN" <rj*@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi

In the mainscreen I have a datagrid and from here I open new windows on
click of link button. And I'm doing it through RegisterStartupScript

Me.RegisterStartupScript("PopUp", _
"<script language='JavaScript'> " & _
"var winOp = window.open('MyScreen.aspx', 'test');" + _
"if (winOp != null) winOp.focus();" + _
"</script>")

I want to keep track of the windows that are opened and add the window
handles to a javascript array whenever a new window is opened in the
codebehind. In the .aspx page I should be able to access this array.

var winArray = new Array;// populated in .aspx.vb
function test()
{
for(i=0;i<winArray.length;++i)
alert(winArray[i].name);
}

Is there a way to do this?Can this be done through
Page.RegisterArrayDeclaration?
Thanks

rjn

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2

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

Similar topics

3
by: J.R | last post by:
I'm trying to determine if a named child window has been opened before opening a new one, however my challenge is that the child window may have...
10
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...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the...
3
by: Eric van der Niet | last post by:
Hello all, What i want to do is the following. I want to call a c#.net file from an html page. this htm send some parameters to the C# (asp)...
3
by: Michelle Stone | last post by:
hi al i have "variab1 = window.open ("a.aspx", "helloworld"); i do this inside a RegisterStartupScrict ("key", "<script...
6
by: Wardeaux | last post by:
I can't find a way to open a new browser window from my codebehind. 1) My page does a postback to the server. 2) On server I evaluate whether to...
1
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. ...
5
by: nashak | last post by:
Hello, I have a aspx page on which I have a button. In the click event method in code-behind I do some processing and now need to open a new...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.