ASP.NET postback with jQuery?(使用 jQuery 的 ASP.NET 回发?)
问题描述
我有一个 ASP.NET 按钮,但最近,我将其替换为标准 HTML 按钮......我需要做的是回发到 ASP.NET 页面并确保调用了一个方法.
I have a ASP.NET button but recently, I replaced it with a standard HTML button ... What I need to do is a postback to an ASP.NET page and ensure a method is called.
上一个按钮是一个 ASP.NET 按钮,所以我有这个事件:
The previous button was an ASP.NET button, so I had this event:
Protected Sub btnCancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs)
UtilTMP.DisposeObjects()
Server.Transfer("~Forms est.aspx", True)
End
但是我使用的是带有 JavaScript ALERT 的按钮,并且我最近更改为 jQuery UI 模态对话框,但它没有等我回答问题..回发立即发生...所以我决定更改为一个标准的 HTML 按钮……但我需要回发到 ASP.NET 页面并调用类似的方法.
But I was using a button with a JavaScript ALERT and I recently changed to a jQuery UI Modal dialog but it doesn't wait for me to answer the question.. the postback happenes immediatly ... so I decided to change to a standard HTML button ... but I need to postback to the ASP.NET page and call a method like.
如果我只是回发它不会调用清理
If I just postback it won't call the cleanup
Protected Sub Cleanup()
UtilTMP.DisposeObjects()
Server.Transfer("~Forms est.aspx", True)
End
推荐答案
虽然您可以使用 JQuery 进行回发,但调用 Web 方法(页面中的 Web 服务)可能会更好.调用也可能更快,因为您没有发布整个页面 ViewState.
While you can do Postbacks with JQuery, it might be better to call a web method (web service that is in your page). The call could also be faster because you are not posting the entire page ViewState.
这篇关于使用 jQuery 的 ASP.NET 回发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 jQuery 的 ASP.NET 回发?


- C# 中多线程网络服务器的模式 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 输入按键事件处理程序 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01