将事件处理程序附加到事件 OnInit 或 OnLoad

发布于 2024-09-28 04:22:34 字数 176 浏览 14 评论 0原文

你好 在面试网站上发现这个问题 给定 ASP .Net Page 类的以下方法,您将在其中哪个方法中将事件处理程序附加到网页上的控件发布的事件? a) 加载() b) Page_Loader() c) OnInit() d) OnPostBack()

无法在OnLoad 和OnInit 之间做出选择。谁能给我解释一下吗?

Hi
Found this question on an interview site
Given the following methods of the ASP .Net Page class, in which of them would you attach an event handler to an event published by a control on the web page?
a) OnLoad()
b) Page_Loader()
c) OnInit()
d) OnPostBack()

Can't decide between OnLoad and OnInit. Can anyone explain it to me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情绪失控 2024-10-05 04:22:34

这似乎不是一个很好的面试问题。虽然 OnInit 和 OnLoad 之间存在差异,但它们都不适用于将事件处理程序附加到事件。

That doesn't seem like a very good interview question. While there are differences between OnInit and OnLoad, none of them apply to attaching an event handler to an event.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文