这是我父母的幻想盒:
$("a.fb").fancybox({
'autoScale': true,
'opacity': false,
'overlayShow': false,
'width': '90%',
'height': '90%',
'type': 'iframe',
'scrolling': 'yes',
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'titlePosition': 'outside',
'overlayColor': '#000',
'overlayOpacity': 0.9,
'titleFormat': function (title, currentArray, currentIndex, currentOpts) {return '<span
id="fancybox-title-over">' + title + '</span>';}
});
它调用的子fancybox是通过这个元素:
<a class="fbchild" href="AddCode.aspx?Type=<%: System.Net.WebUtility.UrlEncode(Session["CodeTypeID"].ToString()) %>" style="font-family: Tahoma; font-size: small; font-weight: bold; color: #FF0000" title="Add New Code">Add New <%: System.Net.WebUtility.HtmlEncode(Session["CodeType"].ToString()) %></a>
最后,fbchild类定义为:
$("a.fbchild").fancybox({
'autoScale': true,
'opacity': false,
onClosed: function () {parent.location.reload(true);},
'overlayShow': false,
'width': '90%',
'height': '90%',
'type': 'iframe',
'scrolling': 'yes',
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'titlePosition': 'outside',
'overlayColor': '#000',
'overlayOpacity': 0.9,
'titleFormat': function (title, currentArray, currentIndex, currentOpts) {return '<span
id="fancybox-title-over">' + title + '</span>';}
});
问题是,当我关闭子节点时,父节点也会关闭,父节点所在的aspx页面会刷新。如何刷新父级花式框?
答案 0 :(得分:0)
所以我在这里解决了这个问题:)
protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
{
close();
}
void close()
{
string script = "parent.location.reload(true);parent.jQuery.fancybox.close();";
Page.ClientScript.RegisterStartupScript(typeof(Page), "close", string.Format(<script type='text/javascript'>{0}</script>", script));
}
parent.location.reload(true);刷新父级,close()关闭子级。甜!!