开发者

How can I trigger WebControls OnDisposed Event?

I have set breakpoints in my Page Dispose (which overrides but then calls the base Dispose) method and my OnDisposed handler.

The OnDisposed handler is never called, but the Page 开发者_StackOverflowDispose() method is.

If you can't call the handler, what's the point of having the event?

This question is similar to this question.


AutoEventWireup="true" is what you need for OnDisposed to be called.

What does AutoEventWireUp page property mean?

Here is a nice answer on why the breakpoint might not be hit.

When OnDisposed is triggered

Well they're all part of the page lifecycle, but the trouble with disposal is that it might happen after the page lifecycle has ended. When object reference go out of scope they are left to the garbage collector to dispose of, and this can happen after the page has completely finished, which is why you can't guarantee to breakpoint into them. You could explicitly force the disposal, but it's not really going to help your situation, since these are server events anyway. At least, that's what I assume you want; a way to save the client side state of the page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜