There are a couple of ways to kill this bird:
1. Create a user control for the header and drag on each page. A bit tedious
perhaps. If you only have one level, it is easy to save this as a template;
if you nest your site into directories, you will end up fixing broken control
references each time you nest lower (or making multiple templates for
different levels).
2. Create a server control for the header and create a new page template
that uses the server control. This is even easier, as you now have a template
for creating new pages. This requires learning how to do a server control,
but is easy once developed. Note that changes in "chrome" (look and feel)
require recompile of the server control.
3. Use ASP.NET 2.0 and use master pages. Easy, but requires moving to 2.0.
4. Use FrontPage 2003 web templates or Dreamweaver web templates for the
common elements and edit common elements in these programs only. This
actually places the HTML in each page. Requires a separate program for
design, but is fairly simple to maintain.
5. Create a base page class that uses an HTML Writer to output the header
information and inherit from that class. The trick here is making sure the
common elements end up in the right spot, which will either require the ASPX
page to talk to the base class or you will have to completely control the
entire page framework. If you go route 2, you will not be able to use the VS
designer for your pages (yuck) and route 1 will not show up in the designer
(may also be yuck).
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Indiresh" wrote:
Hello friends,
I am new to ASP.NET. I have been working in c#.net. I want to modularize the
ASP program. for ex, the header part is always commom at the web pages, and i
do not want to write the same header code for all the files. Instead i want
to put the header code at a commom function/subroutine and on the page's load
event, would want to invoke these functions. Please suggest how to accomplish
this with a small sample program.
Thanks a lot.