且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否将控件动态添加到模板化用户控件?

更新时间:2021-06-28 07:53:50

找到了解决问题的方法,这就是我加载TUC的方式.

错误:
Found the solution to the problem, which was how I was loading the TUC.

Incorrect:
xpcRegion = new ExpandCollapseRegion();




正确:




Correct:

xpcRegion = (ExpandCollapseRegion)LoadControl("ExpandCollapseRegion.ascx");



进行此简单更改即可解决该问题.另外,发现我可以使用CompiledTemplateBuilder()方法放弃对自定义ITemplate类的需要.真正简化了代码.

-安德鲁



Making this simple change took care of the problem. Also, found that I could forego the need for a custom ITemplate class by using the CompiledTemplateBuilder() method. Really simplifies the code.

-- Andrew