I have this method defined since I will add a link button to each row in a long table. However it does not call the eventHandler. It does cause a asyncPostback but never calls the eventHandler.
public static void InsertLinkButton(string text, string id, EventHandler eventHandler,
UpdatePanel updateSummary, PlaceHolder placeHolder)
{
LinkButton link = new LinkButton();
link.Text = text;
link.Click += eventHandler;
link.CausesValidation = false;
AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
trigger.ControlID = link.ID = "link" + id;
trigger.EventName = "Click";
Utils.Tag(link, placeHolder);
updateSummary.Triggers.Add(trigger);
}
The event handler's signiture:
protected void link_Click(object sender, EventArgs e)
{
//check which link clicked me and do stuff
}
I would call the method with this:
InsertLinkButton("Division", "Division", link_Click, updateSummary, placeHolderSummary);
Is something in this code wrong? Or is my problems elseware?