bnath001
03-05-2012, 09:09 PM
Hello folks,
I have a very simple problem...but stuggling with this.
I have a popup window (.aspx page). It will called from a parent .aspx page. All I want to do is read the name of the parent aspx page in popup page. Based on the name of the parent window, in the page_load event of the popup window, I want to execute some code.
But the only catch is that, I am not able to read the parent window name until the page_load event (of popup window) complets the execution.
1. calling popup window from parent window.
Code:
function OpenWindow_HistoricalRuns() {
var windowIncsimHistRuns = window.open('MVal.aspx', 'Market', 'width=350,height=425,scrollbars=0');
windowIncsimHistRuns.moveTo(500, 300);
}
In the body of the popup window the following function tries to read the parent window name:
function SetDisplay() {
document.getElementById('<%=TextBoxSourcePageName.ClientID%>').value = window.parent.name;
}
In the page_load event of the popup window, I want to see what is value of TextBoxSourcePageName control. I hoped I will get 'MarketVal'. But I never get anything.
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
try
{
if (TextBoxSourcePageName.Text == "MarketVal")
}
}
}
In my situation, I need to know the window.parent.name by the time Page_load event gets triggered on the popup window. Because I have to do some specific thing in the Page_Load event (of popup window), based on window.parent.name.
So my fundamental question is, which one will get fired first in an .aspx page.
1. Javascript in the body tag
or 2. Page_load event of the .aspx page.
If Javascript function in the body tag gets fired first, then by the time I get to Page_Load event, I should already have whatever I need.
thanks
I have a very simple problem...but stuggling with this.
I have a popup window (.aspx page). It will called from a parent .aspx page. All I want to do is read the name of the parent aspx page in popup page. Based on the name of the parent window, in the page_load event of the popup window, I want to execute some code.
But the only catch is that, I am not able to read the parent window name until the page_load event (of popup window) complets the execution.
1. calling popup window from parent window.
Code:
function OpenWindow_HistoricalRuns() {
var windowIncsimHistRuns = window.open('MVal.aspx', 'Market', 'width=350,height=425,scrollbars=0');
windowIncsimHistRuns.moveTo(500, 300);
}
In the body of the popup window the following function tries to read the parent window name:
function SetDisplay() {
document.getElementById('<%=TextBoxSourcePageName.ClientID%>').value = window.parent.name;
}
In the page_load event of the popup window, I want to see what is value of TextBoxSourcePageName control. I hoped I will get 'MarketVal'. But I never get anything.
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
try
{
if (TextBoxSourcePageName.Text == "MarketVal")
}
}
}
In my situation, I need to know the window.parent.name by the time Page_load event gets triggered on the popup window. Because I have to do some specific thing in the Page_Load event (of popup window), based on window.parent.name.
So my fundamental question is, which one will get fired first in an .aspx page.
1. Javascript in the body tag
or 2. Page_load event of the .aspx page.
If Javascript function in the body tag gets fired first, then by the time I get to Page_Load event, I should already have whatever I need.
thanks