Asp.net中的EventArgs [英] EventArgs in Asp.net

查看:185
本文介绍了Asp.net中的EventArgs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




Hi,


protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}



该语句的含义是什么.



What is the meaning of this statement.

推荐答案

在子类的OnInit方法上,您正在调用基类的OnInit.
On the OnInit method of a child class, you are calling the OnInit of the base class.


jasna ashraf写道:
jasna ashraf wrote:

此语句的含义.


它重写OnInit方法以在关联的控件上设置属性,并调用基本方法以完成控件的初始化.


It overriding the OnInit method to set a property on the associated control and call the base method to complete the control initialization.


重写OnInit可以在以下阶段的Initialize阶段执行特定于目标的处理:控制生命周期.
Override OnInit to perform target-specific processing in the Initialize stage of the control lifecycle.
using System;
using System.Web.UI;
using System.Web.UI.Adapters;
public class CustomControlAdapter : ControlAdapter
{
    // Override the ControlAdapter default OnInit implementation.
    protected override void OnInit (EventArgs e)
    {
        // Make the control invisible.
        Control.Visible = false;
        // Call the base method, which calls OnInit of the control,
        // which raises the control Init event.
        base.OnInit(e);
    }
}


这篇关于Asp.net中的EventArgs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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