Search code examples
c#asp.netcustom-server-controlsservercontrols

How can i create a ModalPopupExtender control dynamically from a server control?


I have a composite server control that does quiet a number of things; one of which is to display a ModalPopup OnClick of a dynamically generated HtmlAnchor control.

I need to create this ModalPopupExtender control dynamically in my server control and trigger it from within.

I have been able to create it and trigger it from a button created at design time but not at runtime. This is as a result of the ID assign to the link is always not found by the ModalPopupExtender control.

I have tried assigning a static ID but no success. Can anyone help?


Solution

  • I figured it out. All i needed to do was recreate the HtmlAnchor control in the overridden CreateChildControls method on postback.

    Thanks David for you concern.