asp.net 内联覆盖

发布于 2024-08-18 22:59:42 字数 155 浏览 1 评论 0原文

如果我在 .aspx 页面上编写内联代码,是否可以覆盖 .aspx 直接继承的类的 onLoad?

现在,如果我在 .aspx 页面上覆盖 base.onLoad 内联,它将覆盖“Page”对象的 onLoad 事件,而不是 .aspx 继承的类。

感谢您的帮助。

If I'm writing in-line code on a .aspx page is it possible to override the onLoad of the class that the .aspx is directly inheriting from?

Right now if I do the override the base.onLoad inline on the .aspx page it is overriding the "Page" object's onLoad event not the class the .aspx is inheriting from.

Thanks for your help.

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

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

发布评论

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

评论(1

留一抹残留的笑 2024-08-25 22:59:42

您是否尝试在 aspx 页面中创建内联类?

<script runat="server">
    public class MyPage : MyBaseClass
    {
        protected override OnLoad....
    }
</script>

然后让你的 aspx 标头继承自 MyPage

Did you try creating a class inline in your aspx page?

<script runat="server">
    public class MyPage : MyBaseClass
    {
        protected override OnLoad....
    }
</script>

and then have your aspx header inherit from MyPage

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