navin_raley 0 Newbie Poster

I have a tree control in a ASP .NET page, which creates dynamic LinkButton controls with associated event handlers when user clicks on a tree node. The problem is that the control appears to be created properly, but the event handler linkButton_Click is not getting triggered.
Following is my code which is invoked during OnSelectedNodeChanged of the asp:TreeView object:

LinkButton test = new LinkButton();
test.Text = "testbutton";
test.Click += new EventHandler(linkButton_Click);
BreadCrumbs.Controls.Add(test); //BreadCrumbs is a div element

If I paste the above code in Page_Load, the event handler linkButton_Click is triggered properly. Can someone please tell what could be wrong?
Thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.