I have an aspx page, c#, that loads in Ajax Update Panel. After page loads I override Page_Render so that I can save the page content as a pdf. After writing the file I want to redirect parent (my page is inside iframe) to another location on same site. I put the script to redirect inside void
private void RedirectWindowHome()
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "redirectit", "parent.window.location = '/sites/service/zones/default.aspx'", true);
}
I call that from inside the overridden page render
protected override void Render(HtmlTextWriter writer)
{
//setup tw and write file..............
if (!System.IO.File.Exists(pathString2))
{
File.WriteAllBytes(pathString2, pdfBytes);
}
else
{
Console.WriteLine("File \"{0}\" already exists.", fileName);
return;
}
//file does write and I move to next line
RedirectWindowHome();
// I even tried putting in button click and button clicks but no redirect
Button1_Click(Button1, EventArgs.Empty);
}
protected void Button1_Click(object sender, EventArgs e)
{
RedirectWindowHome();
}
so I am thinking that script does not register however on another form in the web app the same code
private void RedirectWindowHome()
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "redirectit", "parent.window.location = '/sites/service/zones/default.aspx'", true);
}
is used on a button click, the submit button and the code fires and redirects.
Is it because I am not posting back? However that is why I tried using button click (programmatically) and that does not work.
Too many days with an old app - help?
Cindy