So.. I'm dynamically creating LinkButtons on my page like this:
LinkButton lb = new LinkButton();
lb.Click += new EventHandler(lb_Click);
When one of these LinkButtons is clicked, I need to know which one the links was clicked, then create another LinkButton and attach an onclick event on it. (How) can I do this? If I have understood correctly, click events can't be attached in (this case in) lb_Click function, so is there any way I still could do this?
Edited:
To make this problem more understandable, here's how I tried to make it but it does not work:
LinkButton lb = new LinkButton();
lb.click += new EventHandler(lb_Click);
void lb_Click(object sender, EventArgs e)
{
LinkButton lb2 = new LinkButton();
lb2.click += new EventHandler(lb2_Click);
}
void lb2_Click(object sender, EventArgs e)
{
//do something
}
Clicking lb2 does not fire the lb2_Click event.