Hi Dave,
When we open a new browser window from one browser window/page, the
relation between them can be get through client-side script, server-side
page model have no sense of client windows. And for opener and child
window, we can use the "window.opener" script code to reference them.
So, for your scenario, I think you can consider registering a client-script
block after the upload page(sub page) have processed and saved the uploaded
file. The script will call a script function in the opener page and close
itself. e.g;
================
public partial class Upload_UploadDlg : System.Web.UI.Page
{
public const string SCRIPT = @"
<script language='javascript'>
window.opener.end_upload();
window.self.close();
</script>
";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnUpload_Click(object sender, EventArgs e)
{
if (fu1.HasFile)
{
Session["upload_file_name"] = fu1.FileName;
lblMessage.Text = "file is uploaded at " +
DateTime.Now.ToLongTimeString();
Page.ClientScript.RegisterStartupScript(this.GetType(),
"close_script", SCRIPT);
}
}
}
===========================
as you see, in the upload page, i stored the uploaded file's name in the
session for later use. Then, register the client script to call a script
function defined in opener page and close itself.
In the opener page, the clientscript is like below:
============
function end_upload()
{
document.getElementById("btnSubmit").click();
}
=============
it programmatically call a button's click method to submit the page. We can
then do some processing on the server and read the uploaded filename from
session.
BTW, if you do not need to do any server-side processing on the opener
page, just want to show the uploaded file's name. We can just let the
upload page's script pass the name to opener page through the script
function, that can avoid additional postback.
Hope this helps.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may
learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.