0

I prepared an aspx file that can open a new window with (window.open) command. In the child window, some values send to parent page with (.innerHTML) command and it can close itself . However, after I set a master page to parent page , command can not send any value from new window to parent and it can not close itself.

How master page can affect my javascript commands?
Thanks


EDIT: By drachenstern (I do what I can with what I have ... this is what he pasted)

From child code behind:

<br> Page.RegisterStartupScript("CLOSE",
  "<...JS...><script type=\"text/javascript\">" +<br>
  "window.opener.document.getElementById('TableID').innerHTML = \"" + RadioNumber + "\";" +<br>
"window.opener.document.getElementById('HiddenTableID').value = \"" + RadioNumber + "\";  
<br>
self.close();" +
"<...JS....></script>"
);<br>

Parent side:

<br>
..a ..<br>href="javascript:window.open('SelectTable.aspx','OPEN','toolbar=no,directories=no,status=no,titlebar=no,menubar=no,scrollbars=no,resizable=no,width=800,height=600,top=0,left=0,');"/>SelectSomthng<br>../a..

SECOND EDIT: (again drachenstern) It would appear this is the intention

From child code behind:

Page.RegisterStartupScript("CLOSE",
  "<...JS...><script type=\"text/javascript\">" +
  "window.opener.document.getElementById('TableID').innerHTML = \""   + RadioNumber + "\";" +
  "window.opener.document.getElementById('HiddenTableID').value = \"" + RadioNumber + "\"; +
  self.close();" + "<...JS....></script>");

Parent side:

/* drachenstern: notice I put the carriage returns for legibility, not in the original code*/
<a href="javascript:window.open(
'SelectTable.aspx',
'OPEN',
'toolbar=no,directories=no,status=no,titlebar=no,menubar=no,
scrollbars=no,resizable=no,width=800,height=600,top=0,left=0,'
);"/>SelectSomthng</a>
3
  • 3
    Please show us your code (resulting HTML & JS), my crystal ball fell in pieces last weekend... Commented Dec 1, 2010 at 21:41
  • Irgat, you can edit your own question, please do so (and don't forget to use the <code>-button [010101]). Commented Dec 1, 2010 at 21:44
  • ~ This doesn't sound like a master page problem but a javascript problem. It sounds like you lost the reference to the window when you changed pages. As @MarcelKorpel says, please post some code so we can help you Commented Dec 1, 2010 at 21:46

2 Answers 2

1

if you want to get the control of parent page in the child window and using master page for the parent page... then you can use following to get the control of input type or any other type using the TagName

var collection=window.opener.document.body.getElementsByTagName('input')

alert(collection[o].id);  
alert(collection[1].id);
alert(collection[2].id);..... ext

you can traverse through the collection to and find the id you want by indexOf() method and perform whatever things you want.

Sign up to request clarification or add additional context in comments.

Comments

0

From child code behind:
Page.RegisterStartupScript("CLOSE", "<...JS...>" +
"window.opener.document.getElementById('TableID').innerHTML = \"" + RadioNumber + "\";" +
"window.opener.document.getElementById('HiddenTableID').value = \"" + RadioNumber + "\";" +
"self.close();" + "<...JS....>" );

Parent side:
..a ..
href="javascript:window.open('SelectTable.aspx','OPEN','toolbar=no,directories=no,status=no,titlebar=no, menubar=no,scrollbars=no,resizable=no,width=800,height=600,top=0,left=0,');"/>SelectSomthng
../a..

3 Comments

~ notice I "edit"ed your original question and cleaned up the code so that it's legibile as IDE code. I'm still not 100% on what you intend there, but at least we have something. What goes in the master page? Where? By Master Page you do mean a file like MasterPage.Master in your build, right? Or do you equate "master" to mean "original" or "starting page" or "users primary screen"?
I'll explain clearly again. I want to open new window that I can select some radiobutton and I want to send this value to main page.Master page is masterpage.master. I disconnect masterpage.master from main page, everythng is OK.
I think that child window can not reference to parent

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.