从后面的代码关闭 FaceBox
我无法从代码隐藏中关闭 jQuery Facebox。我正在通过 FaceBox 插入一条新记录,成功插入后需要关闭 FaceBox。我怎样才能做到这一点?
I am having trouble closing jQuery Facebox from code behind. I am inserting a new record through FaceBox, on successful insertion the FaceBox needs to be closed. How can i achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Facebox公开了一些事件,其中之一是facebox.close。所以,你可以做这样的事情:
这应该为你关闭脸箱。
编辑:要通过代码隐藏来执行此操作,您似乎需要从代码隐藏页面编写实际的 javascript。我不是 .NET 程序员,但这个问题看起来可能会为您指明正确的方向:how to write javascript in asp.net in使用 C# 的代码隐藏
关键是,如果触发
close.facebox
事件,Facebox 将关闭。Facebox exposes some events, one of them is
facebox.close
. So, you could do something like this:That should close the facebox for you.
EDIT: To do this via code-behind, it looks like you'll need to write the actual javascript from your code-behind page. I'm not a .NET programmer, but this question looks like it might point you in the right direction: how to write javascript in asp.net in code behind using C#
The key is that if you trigger the
close.facebox
event, Facebox will close.已解决:
Aspx页面:
//Add data fields and button from an user control
Aspx.cs页面:
Page page = HttpContext.Current.Handler as Page;
if (页!= null)
{
ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "close_facebox()", true);
}
Js函数:
function close_facebox() {
$('#addlink').css('显示', '无');
$('#addlink').overlay().close();
}
Solved:
Aspx page:
//Add data fields and button from an user control
Aspx.cs page:
Page page = HttpContext.Current.Handler as Page;
if (page != null)
{
ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "close_facebox()", true);
}
Js function:
function close_facebox() {
$('#addlink').css('display', 'none');
$('#addlink').overlay().close();
}