jquery Thickbox 在 2005 ASP.NET 中无法工作

发布于 2024-08-27 18:58:25 字数 743 浏览 6 评论 0原文

public void DisplayThickBox(Page page, int width, int height)
    {
        string script = "<script type='text/javascript'>";
        script += "$(document).ready(function(){";
        script += "tb.show('null', 'auto-insurance-redirect.aspx?keepThis=true&TB_iframe=true&height=" + height.ToString() + "&amp;width=" + width.ToString() + "',null);";
        script += "});";
        script +="</script>";

        ScriptManager.RegisterStartupScript(page, page.GetType(), "", script, true);

    }

^^^显示厚盒的方法...^^^

DisplayThickBox(this, 518, 321);

^^^在触发它的按钮的单击事件中调用方法...^^^

页面只是刷新,厚盒永远不会显示。我正在尝试手动调用 javascript,因为在后面的代码中显示厚盒之前我正在做一些其他事情......

public void DisplayThickBox(Page page, int width, int height)
    {
        string script = "<script type='text/javascript'>";
        script += "$(document).ready(function(){";
        script += "tb.show('null', 'auto-insurance-redirect.aspx?keepThis=true&TB_iframe=true&height=" + height.ToString() + "&width=" + width.ToString() + "',null);";
        script += "});";
        script +="</script>";

        ScriptManager.RegisterStartupScript(page, page.GetType(), "", script, true);

    }

^^^Method to display the thickbox...^^^

DisplayThickBox(this, 518, 321);

^^^Call to method in the click event of the button that fires it...^^^

Page is just refreshing and the thickbox is never displayed. I'm trying to call the javascript manually since im doing some other stuff before i display the thickbox in the code behind...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

番薯 2024-09-03 18:58:25

听起来像是您在按钮单击事件上调用此事件,该事件将回发到服务器。您需要在客户端上注册 javascript 并从 javascript 调用它,而不是通过服务器端代码。您现在拥有的是一个启动脚本,该脚本应该在页面加载时运行,但这并不是您真正想要的。

Sounds like you're calling this on a button click event which would postback to the server. You'll need to register the javascript on the client and call it from javascript, not thru server side code. What you have now is a startup script which should run when the page loads, that's not really what you want.

睡美人的小仙女 2024-09-03 18:58:25

查看您的 javascript 参数:

"tb.show('null', 'auto-insurance-redirect.aspx?keepThis=true&TB_iframe=true&height=" + height.ToString() + "&width=" + width.ToString() + "',null);"

我注意到一些参数由 & 分隔,其他参数由 & 分隔。也许这就是问题所在。

Looking at your javascript parameters:

"tb.show('null', 'auto-insurance-redirect.aspx?keepThis=true&TB_iframe=true&height=" + height.ToString() + "&width=" + width.ToString() + "',null);"

I notice that some parameters are separated by & and others are separated by &. Maybe this is the problem.

纵性 2024-09-03 18:58:25

把它修好了,不知道如何......我尝试了很多东西,所有东西都变得肮脏和聚集,所以我把所有东西都拿出来,从空白开始,它立即起作用了。

感谢大家的帮助!

Got it fixed, no idea how...I had tried so many things and everything was getting dirty and clustered, so I took everything out and started back from blank and it worked right off the bat.

Thanks everyone for their help!

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