Here is my whole control and it works. Take a peek at it and see what you're
doing wrong.
[ToolboxData("<{0}:MyButtonControl runat=server></{0}:MyButtonControl>")]
public class MyButtonControl :
System.Web.UI.WebControls.WebControl,INamingContai ner
{
private Button btn;
protected override void CreateChildControls()
{
btn = new Button();
btn.Text = "Click Me";
btn.Click += new EventHandler(btn_Click);
Controls.Add(btn);
base.CreateChildControls ();
}
protected override void Render(HtmlTextWriter output)
{
base.Render(output);
}
private void btn_Click(object sender, EventArgs e)
{
btn.Text = "I was clicked!";
}
}
--
-Demetri
"murl" wrote:
protected override void CreateChildControls()
{
btnGenerate = new Button();
//btnGenerate.ID="btnGenerate";
btnGenerate.Click += new EventHandler( btnGenerate_Click );
btnGenerate.Text = "Generate Report";
Controls.Add(btnGenerate);
base.CreateChildControls();
}
I still can't catch the event on the Server Control from the button
click, hrmmmmm