从后面的代码关闭 FaceBox

发布于 2024-10-10 06:33:34 字数 85 浏览 0 评论 0原文

我无法从代码隐藏中关闭 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

GRAY°灰色天空 2024-10-17 06:33:34

Facebox公开了一些事件,其中之一是facebox.close。所以,你可以做这样的事情:

function add_record() {
    // ... add the record here ...
    jQuery(document).trigger('close.facebox');
    //or: $(document).trigger('close.facebox');
}

这应该为你关闭脸箱。

编辑:要通过代码隐藏来执行此操作,您似乎需要从代码隐藏页面编写实际的 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:

function add_record() {
    // ... add the record here ...
    jQuery(document).trigger('close.facebox');
    //or: $(document).trigger('close.facebox');
}

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.

躲猫猫 2024-10-17 06:33:34

已解决:

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();
}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文