ASP.NET Custom Controls - Composites

后端 未结 6 520
别跟我提以往
别跟我提以往 2020-12-13 20:13

Summary

Hi All,
OK, further into my adventures with custom controls...

In summary, here is that I have learned of three main "classes" of cus

6条回答
  •  暖寄归人
    2020-12-13 20:45

    You might be able to make use of this technique to make design-time easier:

    http://aspadvice.com/blogs/ssmith/archive/2007/10/19/Render-User-Control-as-String-Template.aspx

    Basically you create an instance of a user control at runtime using the LoadControl method, then hand it a statebag of some kind, then attach it to the control tree. So your composite control would actually function like more of a controller, and the .ascx file would be like a view.

    This would save you the trouble of having to instantiate the entire control tree and style the control in C#!

提交回复
热议问题