如何在asp.net页面上使用onUnload事件? [英] How can I use onUnload event on a asp.net page?

查看:245
本文介绍了如何在asp.net页面上使用onUnload事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我倾向于在关闭我的asp.net页面时使用close事件,因为该页面上的Dropdownlist控件上有一个POSTBACK事件,当页面回发将被关闭时.
onUnload事件只是卸载事件,而不是关闭事件,我在Google上搜索,无法找到结果,任何有这种经验的人都可以帮助我吗?或给我一些建议.

I likt to use close event while closing my asp.net page, because there is a POSTBACK event on a Dropdownlist control in that page, when the page postback it will be closed.
onUnload event is just unload event ,not the closing event, I googled ,cant find result, can anyone who has this experience help me? or give me some suggestions.

推荐答案

您可以在javascript的帮助下在客户端访问此事件:

http://www.w3schools.com/jsref/event_onunload.asp [
You have access to this event on client side with help of javascript :

http://www.w3schools.com/jsref/event_onunload.asp[^]

do some AJAX actions in your javascript evenet handler to notify the server.

The other way that may not help you is Session_End in Global.asax file. but if you need an immediate reaction the javascript event handler is very suitable.


这篇关于如何在asp.net页面上使用onUnload事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆