Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any advice on creating a template Web Site? 3

Status
Not open for further replies.

jw970170

Programmer
Aug 8, 2005
38
Hello everyone,

I am creating a website using Visual Studio .NET. Is there any special way to create a template?

My current method is to include a header and a footer file in each html page generated by Visual Studio. Is there a better way of creating a template?

 
Create a custom page that inherits from System.Web.UI.Page. I have created quite a complex page that outputs XHTML compliant code, neatly formatted. It also uses a title property for setting a page title and properties for setting css links and script. The page contains header, footer and navigation that is used on every page. Then all I need to do to create a new page is inherit from that base class and put the content in.

Jon

"I don't regret this, but I both rue and lament it.
 
hello again,

I've looked at those master pages sites you guys gave me. It would be perfect but it looks like it only runs with visual studio 2005. I am running 2003 and cannot upgrade at this time. Is there something similar in 2003?
 
Ok, thanks everyone for your help. I did end up using page inheritance. It works quite well and was easy to implement once I figured out what I was doing. thanks for your suggestions everyone.
 
one other thing. I was using some tutorial that used the render method to create the template. The one you (JontyMC ) gave me is better. However, I don't know how to set the title property . In my code, I have

Private strTitle As String = "asdaf"

Public Property Title() As String
Get
Title = strTitle
End Get
Set(ByVal Value As String)
strTitle = Value
End Set
End Property

in my base class. In my other class (which inherits the above one), I tried Me.Title = "new title adafdadf" but it did not work. Any ideas?
 
I presume your trying to add it to the page load method? You need to put it in the class constructor.

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top