Feb 25, 2008

Dynamically adding control which can do async postback in UpdatePanel

Precondition, The control needs to have Id, if not the ajax clientside script can not handle it. Then see the following code.

Dim btn As LinkButton = CType(child, LinkButton)
AddHandler btn.Click, AddressOf ProcessFilter
''me.UpdatePanel1.Triggers.Add(as
'Dim trigger As UpdatePanelControlTrigger = New UpdatePanelControlTrigger
Dim trigger As AsyncPostBackTrigger = New AsyncPostBackTrigger()
trigger.ControlID = btn.UniqueID
trigger.EventName = "Click"
Me.UpdatePanel1.Triggers.Add(trigger)