从位于更新面板内部的 ASP.NET 按钮调用 Javascript

发布于 2024-08-16 06:06:20 字数 188 浏览 1 评论 0原文

我正在使用 JQuery 来切换 Web 表单应用程序中的可见性。我正在使用更新面板来抑制单击我的回发。单击此按钮时我想做的是调用 JQuery 代码,我用它来在回发完成后切换。我需要实现什么代码(客户端或服务器端)?感谢您。

编辑:

我不仅需要在回发完成时触发切换事件,而且还需要在服务器端代码表明用户的输入有效时触发切换事件。

I am using JQuery to toggle the visibility of a in a webforms application. I am using an update panel to suppress the postback when my is clicked. What I would like to do when this is clicked is call the JQuery code that I use to toggle the once the postback has completed. What code(client-side or server-side) do I need to implement? Thanks you.

Edit:

I don't just need to fire the toggle event when the postback has completed, but when server-side code says that the user's input is valid.

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

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

发布评论

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

评论(2

月朦胧 2024-08-23 06:06:20

您可以在服务器端尝试此操作:

if(<input is valid>)
{
ScriptManager.RegisterStartupScript(this.Page,this.Page.GetType(),"Toggle", "your javascript function call", true);
}

这将在回发完成时调用您的函数

you can try this on server side:

if(<input is valid>)
{
ScriptManager.RegisterStartupScript(this.Page,this.Page.GetType(),"Toggle", "your javascript function call", true);
}

this will call your function when the postback completes

热血少△年 2024-08-23 06:06:20

当然:

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

这是一个 JavaScRipt 回调。只需插入处理程序即可切换代码

Sure:

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

This is a JavaScRipt callback. Just plug you handler in to toggle your code

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