Run-time and design-time added controls

220 Views Asked by At

Who is responsible to maintain the web controls (ASP:Button) for example that added in the design time to be available after doing postBack? while run-time-added controls wont be available if you do not add them back again?

2

There are 2 best solutions below

0
On BEST ANSWER

ASP.NET is the one responsible. Controls that you have added in the design time (ASPX or ASCX file) are compiled together with the code-behind class into a single object. This is done by the compiler. Since controls that you add to the page runtime are not available when the compiler executes, they cannot be preserved and you should take care to do it yourself.

0
On

The ASP.NET backend is reponsible for that.

Note that there are no “design-time added” and “run-time added” controls. There are just controls that sit in the page statically, always, and dynamically, decided by the page's very own (=your) logic.