我做这门课:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI;
namespace Class1
{
[
ToolboxData("<{0}:Class1 runat=\"server\"> </{0}:Class1>")
]
public class Class1 : TextBox
{
public Class1()
{
}
protected override void Render(HtmlTextWriter writer)
{
Button btn = new Button();
btn.Text = "Click me ... ";
btn.RenderControl(writer);
btn.Click += new EventHandler(btn_Click);
base.Render(writer);
}
protected void btn_Click(object sender, EventArgs e)
{
this.Text = DateTime.Now.ToLongTimeString();
}
}
}
但是 btn_Click
没有触发的事件?