ASP.Net: Custom ASP.NET server controls

Custom ASP.NET server controls enable page developers to dynamically generate HTML user interface (UI) and respond to client requests. They are represented within a file using a declarative, tag-based syntax. These tags are distinguished from other tags because they contain a "runat=server" attribute. The following example demonstrates how an server control can be used within an ASP.NET page. This control corresponds to the Label class in the System.Web.UI.WebControls namespace, which is included by default.

By adding a tag with the ID "Message", an instance of Label is created at run time:


<html>
<script language="VB" runat=server>
Sub Page_Load(Sender As Object, E As EventArgs) Message.Text = "Welcome to ASP.NET"
End Sub
</script>

<body>
<asp:label id="Message" font-size=24 runat=server/>
</body>
</html>

HTML server controls enable page developers to programmatically manipulate HTML elements within a page. An HTML server control tag is distinguished from client HTML elements by means of a "runat=server" attribute. The following example demonstrates how an HTML server control can be used within an ASP.NET page.


Read Users' Comments (0)

0 Response to "ASP.Net: Custom ASP.NET server controls"

Post a Comment