469,964 Members | 1,772 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

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 2686
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Marshall Dudley | last post: by
3 posts views Thread by NeverLift | last post: by
3 posts views Thread by Eric van der Niet | last post: by
6 posts views Thread by Wardeaux | last post: by
7 posts views Thread by anthony.turcotte | last post: by
5 posts views Thread by nashak | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.