CODECUBE VENTURES

Template User control

User controls are a very powerful part of ASP.Net.

in classic ASP, many people used include files for template functions... user controls can be used to extend this concept

These are some very simple examples of how you can use user controls to handle some of the layout... just use the same templating concepts discussed in this article

Header.ascx


<script language="VB" runat="Server">
public title as string

sub page_load(o as object, e as eventargs)
lblTitle.text = title
end sub
</script>
<html>
<head>
<title><asp:label id="lblTitle" runat="server" / ></title>
</head>
<body>

Footer.ascx


<script language="VB" runat="Server">
public copyright as string

sub page_load(o as object, e as eventargs)
lblCopy.text = copyright
end sub
</script>
<hr>
<asp:label id="lblTitle" runat="server" / >
</body>

Latest post: Digging Up the First Version of CodeCube

See more in the archives