Include block of code
I have a big block of code that I am using as a navigation bar for my site. I am constantly changing it though. Is there some way to save it all in one file and then include it in each page so that I don't have to change it multiple times every time I want to edit it? I am building it using ASP.net on VWD 2005 Beta 2.
You want to include server side code? I would say just use a class or a code behind.
Yes, it is very common to do this.
You need to use either a User Control or a Server Control.
There are different strengths for each of these options. If you want to read more about these strengths and weaknesses then go here:
I think the main issue will be that if you want the navigation bar to be dynamic then you will want to use a server control otherwise it may be more simple to just create a User Control.
To learn how to create and include a User Control in a page go here:
Good Luck AConnorABBCO
Yes, User Control is the way to go. Simpler to create than Server Control. Think of them as "smart include files" (if you are familiar with classic ASP server side includes).
Goto http://www.geewebtools.com/web-content-management/ - the nav buttons "overview"..."demo" are done with one user control object with different attributes set in the html tag declaration for each of our 25 modules to determine its behavior.
Once you start with User Controls in .NET, you will love them.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)