简体   繁体   English

如何从服务器控件动态创建ModalPopupExtender控件?

[英]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. 其中之一是显示动态生成的HtmlAnchor控件的ModalPopup OnClick。

I need to create this ModalPopupExtender control dynamically in my server control and trigger it from within. 我需要在服务器控件中动态创建此ModalPopupExtender控件,然后从内部触发它。

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. 这是由于ModalPopupExtender控件始终找不到分配给链接的ID。

I have tried assigning a static ID but no success. 我尝试分配一个静态ID,但没有成功。 Can anyone help? 有人可以帮忙吗?

I figured it out. 我想到了。 All i needed to do was recreate the HtmlAnchor control in the overridden CreateChildControls method on postback. 我要做的就是在回发时在重写的CreateChildControls方法中重新创建HtmlAnchor控件。

Thanks David for you concern. 谢谢大卫的关心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM