Author: RogerWilco | Posted on: 9/16/2009 9:28:00 PM | Views : 535



I've created the following custom control class in a new web site project and put it on the Default.aspx page. I see the link button "This is a test LinkButton", but clicking it does not trigger the OnLinkClick handler...
What am I doing wrong?
public class TestControl : WebControl { public LinkButton buttonInstance = new LinkButton(); protected override void CreateChildControls() { base.CreateChildControls(); buttonInstance.Text = "This is a test LinkButton"; buttonInstance.Click += new EventHandler(OnLinkClick); Controls.Add(buttonInstance); Controls.Add(new LiteralControl("<br />")); } void OnLinkClick(object sender, EventArgs e) { ...

Go to the complete details ...