I'm having some trouble creating triggers for items inside of a repeater. I would like a Linkbutton
control to trigger a postback from within an update panel, I have a trigger defined in markup for a Button
control which works fine:
<Triggers>
<asp:PostBackTrigger ControlID="button" />
</Triggers>
However, I can't do this for the LinkButton
s as they're created dynamically, only solution would be to add a trigger for each button in my repeaters data bound event like so:
//Inside repeater itemdatabound...
var trigger = new PostBackTrigger();
trigger.ControlID = linkButton.UniqueID;
updatepanel.Triggers.Add(trigger);
When running this code I receive an error:
A control with ID 'ctl00$content$repeater$ctl01$linkButton' could not be found for the trigger in UpdatePanel 'updatepanel'.
How can I dynamically add triggers for each of my LinkButtons
?