A
Axel Dahmen
HI,
I want to dynamically add controls to a web page from within a common base
class. Unfortunately, ASP.NET fails with "System.Web.HttpException: The
Controls collection cannot be modified because the control contains code
blocks (i.e. <% ... %>)."
All of my pages contain these kind of blocks, for several reasons. For one,
I don't know any other way to dynamically add header information like e.g.
style sheet links to a web page. So, is there some way to dynamically add
controls to a web page while keeping these code blocks?
To be precise: I've derived a base class from Page (MyPage). All my pages
are derived from MyPage. In the Page_Load event of MyPage I want to add
navigation controls at the top of all pages where appropriate.
Is there a way to achieve this without writing a web control and add it to
each and every page?
TIA,
Axel Dahmen
I want to dynamically add controls to a web page from within a common base
class. Unfortunately, ASP.NET fails with "System.Web.HttpException: The
Controls collection cannot be modified because the control contains code
blocks (i.e. <% ... %>)."
All of my pages contain these kind of blocks, for several reasons. For one,
I don't know any other way to dynamically add header information like e.g.
style sheet links to a web page. So, is there some way to dynamically add
controls to a web page while keeping these code blocks?
To be precise: I've derived a base class from Page (MyPage). All my pages
are derived from MyPage. In the Page_Load event of MyPage I want to add
navigation controls at the top of all pages where appropriate.
Is there a way to achieve this without writing a web control and add it to
each and every page?
TIA,
Axel Dahmen