I have two aspx pages, one.aspx and two.aspx, and a JavaScript file named link.js.
My goal is to establish communication between these two aspx pages using the JavaScript file as an intermediary.
In the one.aspx file, I have a ModalPopupExtender with its panel content located in two.aspx. This means that in "one.aspx" :
<html>
<head>
<script type="text/javascript" src="link.js"></script>
<script type="type="text/javascript">
function test(){
var str=callPopup();
document.getElementById('pnlPopUp').innerHtml = str;
}
</script>
</head>
<body>
<ajaxToolkit:ModalPopupExtender ID="popup1" runat="server" TargetControlID="btnOK" CancelControlID="btnCancel" PopupControlID="pnlPopUp"></ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="pnlPopUp" runat="server"></asp:Panel>
</body>
</html>
In "two.aspx" :
<html>
<head>
<script type="text/javascript" src="link.js"></script>
</head>
<body>
<asp:Panel ID="pPanel1" runat="server">
<table>
<tr>
<td>
<p>test</p>
</td>
<td>
<asp:Button ID="BtnTest" runat="server" Text="Click" OnClientClick="javascript:alert('hello world..!'); return false;" />
</td>
</tr>
</table>
</asp:Panel> </body> </html>
In link.js:
function callPopup() {
var s = document.getElementById('pPanel1').innerHtml;
return s;
}
I am able to call callPopup() from one.aspx but unable to retrieve the content from two.aspx page. Please assist me with this issue.
Thank you in advance.