I’m using ASP.NET web forms in Visual Studio 2010. How can I create UI controls and such programmatically? For example, I want to define in separate form files to have a side-bar menu and such, and then the resulting pages will inherit that functionality. In my base class, I added a new control to this.Controls, but generating the page throws an exception, saying that the control must be placed inside a tag with runat="server". If I want to generate these controls programmatically, how do I place them inside such a tag?
I’m using ASP.NET web forms in Visual Studio 2010. How can I create UI
Share
You write:
which makes me believe you are better off using Master Pages, here’s a tutorial on ASP.NET master pages (use Google to find more). However, inheritance itself can also easily be achieved by taking any existing control and extending it:
Later you write:
which is not entirely related. This is simply true: every server control must have a
runat="server"_ or it won’t be recognized by the ASP.NET parser. I.e., like this: