问题描述
我有一个 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 回发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!