按钮Button动态事件的名称

    protected override void OnInit(EventArgs e)
    {
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        this.Events.AddHandler("OnButton", new EventHandler(BtnShow));
        this.Button1.Click += (EventHandler)this.Events["OnButton"];
    }

    private void Button1_Click(object sender, System.EventArgs e)
    {
        Response.Write("成功");
    }

    public void BtnShow(object sender, System.EventArgs e)
    {
        Response.Write("成功");
    }

posted @ 2012-02-14 17:41  踏浪帅  阅读(307)  评论(0编辑  收藏  举报