tags:

views:

49

answers:

4

The thing is I have a page A.aspx there is script in that which will create a tab. from A I'm opening another page B.aspx .

What I want is when I click a button in B.aspx . The script in A.aspx should execute . or else the link in A.aspx which call that script should execute ..

A: 

I am not sure whether this is the solution for your question. You can issue a Server.Transfer to Page A from Page B and pass a context variable also. Check this context variable and then in the Page_Load event you can call the javascript function by using

ClientScript.RegisterClientScriptBlock method

rahul
A: 

if the calling window opened the called window just use the handle returned from the window.open. otherwise no dice.

Sky Sanders
A: 

First, you need a link to open the new window with a call to the window.open() function, passing it a URL and a target. Pass it '_blank' to inform the browser to use a new window:

Add this link within A.aspx:

<a href="#" onclick="window.open('B.html', '_blank'); return false;">
    New window
</a>

Second, you'll also need a reference to the new window's opener, which is the window which created the new window:

Add this code within B.aspx (please replace FUNCTION_NAME() with your function identifier) to call your parent window's function:

<script type="text/javascript">
    window.opener.FUNCTION_NAME(); // Call FUNCTION_NAME() within A.aspx.
</script>

You can also access window.opener.document to access the original window's DOM.

More information is available here:

Documentation for window.open() function

DOcumentation for window.opener object

Abboq
+1  A: 

you should not do this. It is insecure.

Jeremy Petzold