父窗口
方式一
<script>
//回调业务,已转移到WindowUploadCos_Close后台事件
function UploadCallBack(CommonName, resultObject) {
switch (CommonName) {
case 'CourseFile':
console.log(resultObject)
break;
}
}
</script>
//方式二
protected void WindowUploadCos_Close(object sender, WindowCloseEventArgs e)
{
if (e.CloseArgument.StartsWith("CourseFile$"))
{
string resultJSON = e.CloseArgument.Substring("CourseFile$".Length);
MD.Knowledge.AttachmentInfo resultObject = JsonConvert.DeserializeObject<MD.Knowledge.AttachmentInfo>(resultJSON);
}
}
子窗口
protected void btnSaveClose_Click(object sender, EventArgs e)
{
// 方式一:JS回调事件
//PageContext.RegisterStartupScript(
// String.Format("F.getActiveWindow().window.UploadCallBack({0},{1});", JsHelper.Enquote(CommonName), JsonConvert.SerializeObject(回传Object对象, Formatting.Indented))
// + ActiveWindow.GetHideReference());
// 方式二:后台窗口关闭事件
if (!string.IsNullOrWhiteSpace(hifResultObject.Text))
{
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("CourseFile$" + JsonConvert.SerializeObject(回传Object对象)));
}
else
{
PageContext.RegisterStartupScript(ActiveWindow.GetHideReference());
}
}