I have Page A and Page B
When Page A loads Page B loads too on background (its a service that I need to run).
Page A finishes loading and than Page B finishes loading.
When Page B finishes loading I would like to update a control on Page A
I’ve tried a few things with no success.
First one:
On Page B
protected void Page_Unload(object sender, EventArgs e)
{
parceiros _p = new parceiros();
_p.Update();
}
Since the Page is already rendered it gives me Object reference not set of course (like the label does not exists) by the way, I’ve tried this before the Page B unload too…
Second one:
When Page B finished loading, I’ve called a Javascript function from my code behind, and this javascript is suppose to do the job, it didn’t work as well. I’ve even tried to call a alert() function but i doest not work. Since the Page that the user is, is Page A, it didn’t work but i had to give it try.
Any one have any ideia how can I do this.
I though of Session as well but since page A finishes loading first I don’t know how I could get the value…
Edited as required:
Here is the code I called on the Page_Unload on Page B
string jsGeral = "/js/geral.js";
Page.ClientScript.RegisterClientScriptInclude(jsGeral, jsGeral);
jsChart.Add(dataset);
Page.RegisterStartupScript("myScript", "<script language=JavaScript>DoSomething();</script>");
Response.Write(jsChart.ToString());
This is generally what you can do:
In page A:
Load Page B
In page B after loaded:
Set a session variable
In page A:
Server Side: Define a function that returns new control content if the session variable is set.
Client Side: Periodically check for the new content by invoking that function in your page.