I have an ASP Button that I am creating in the CodeBhind of a Control. Here is the code:
Button SubmitButton = new Button();
protected override void CreateChildControls()
{
SubmitButton.Text = "Submit";
SubmitButton.Click += new EventHandler(SubmitButton_Click);
}
private void SubmitButton_Click(object sender, EventArgs e)
{
CustomTabs.CreateNewTab();
}
The Click event won’t fire, though. It appears like it does a postback and never hits the event. Any ideas?
So you have some methods that are not explained, but are you adding the
SubmitButtonto the page? Somewhere should be:The following works for me (Obviously change namespace):
ASPX
ASPX.CS