且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么 OnBeforeUnload 使用 asp:LinkBut​​ton 触发两次?

更新时间:2023-02-05 20:39:40

我遇到了类似的问题,但是,我根本不想为 LinkBut​​tons 触发 onbeforeunload,因此我对 .aspx 上的每个 LinkBut​​ton 使用了以下内容页面:

I had a similar problem, however, I didn't want to fire onbeforeunload for LinkButtons at all, therefore I used the following for every LinkButton on the .aspx page:

OnClientClick="eval(this.href);return false"

LinkBut​​tons 的功能并没有被削弱,因为它们所做的只是提供一个带有 CommandArgument 的 Command 以供代码隐藏处理......

Functionality of the LinkButtons wasn't crippled, since all they did was supplying a Command with CommandArgument for the codebehind to handle...