Whether creating new server controls or adding Web Forms functionality to a previously designed Web page, adding server controls to a page is simple.
The following example shows how one can declaratively add three instances of the <asp:label>
control to a Web Forms page.
<html> <body> <h3><font face="Verdana">Declaring Server Controls</font></h3> <p>The following are instances of the Web Forms Label Web control. <hr> <asp:label id="Message1" font-size="16" font-bold="true" forecolor="red" runat=server>This is Message One</asp:label> <br> <asp:label id="Message2" font-size="20" font-italic="true" forecolor="blue" runat=server>This is Message Two</asp:label> <br> <asp:label id="Message3" font-size="24" font-underline="true" forecolor="green" runat=server>This is Message Three</asp:label> <body> </html>
Each instance of the control has different values for the properties declared on them. Notice that these properties are declared in the same way that standard HTML attributes are.
Any Web Form control can be added to a page by simply declaring them directly in a text file, or an HTML designer such as Microsoft® FrontPage.
See Also
Server Controls | Adding a Server Control to a Page Programmatically | Setting Properties on Server Controls