Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends.

I’m designing a website with asp.net.

In my website I have many web pages.

All pages have a same header, and same menu, and same right menu bar, and others.

Note that the main data in each page is different from others.

For this, I copy the common HTML part of each page and paste it in new page!

Common parts like these:

<div id=”headerDIV” style=… >

</div>

My problem is that how can I type these common parts of each page just one time and use it in all pages?

Without doing like this, I should change all pages when I wanna change a little thing in the header for example!

I think one way is to save the common HTML part in one .html file, and use it like this:
<!--#include file="header.html"-->

But, is it a best solution ?!

Isn’t it cause bad loading of the website especially for users with low speed Internet !?

Is there any better solution?

Thanks in advance.
Posted

1 solution

You should just use a master page.
See here[^]

It allows you to have repeating content you want on any page with the actual code only existing in one location. There are also sections you can change page by page. You can make it look however you want.
 
Share this answer
 
v2
Comments
Thomas Daniels 15-May-13 11:04am    
+5!
Richard C Bishop 15-May-13 11:04am    
Thank you ProgramFOX!
Mohamad77 15-May-13 11:04am    
thanks alot.
Richard C Bishop 15-May-13 11:05am    
You are welcome. If you get stuck on anything, just come back and post a new thread with the code you are having issues with.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900