Robby
Ultimate Contributor
This download illustrates how to create a base class from which all your aspx pages can inherit.
Why use templates?
If youre designing a web site with more than a couple of pages then templates could be the answer. The benefits of well designed templates; getting rid of redundant code, easier to separate HTML from server-side scripts as well as the obvious, consistent look and reuse of UI code.
Why not use User Controls?
User Controls have their place as well. If anything they can be even easier to create than templates. Perhaps Ill visit this topic at a later date.
Actually, I whipped up this sample because recently many were asking on how to use Includes in ASP.NET. So I figured why use Includes when you can be using Templates and User Controls.
Most of the code in the sample project is commented otherwise it should be self-explanatory.
Why use templates?
If youre designing a web site with more than a couple of pages then templates could be the answer. The benefits of well designed templates; getting rid of redundant code, easier to separate HTML from server-side scripts as well as the obvious, consistent look and reuse of UI code.
Why not use User Controls?
User Controls have their place as well. If anything they can be even easier to create than templates. Perhaps Ill visit this topic at a later date.
Actually, I whipped up this sample because recently many were asking on how to use Includes in ASP.NET. So I figured why use Includes when you can be using Templates and User Controls.
Most of the code in the sample project is commented otherwise it should be self-explanatory.