Click here to Skip to main content
15,898,538 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi all, im a junior programmer gona cut straight to the chase ive gt a website that displays information its displayed within a <div> with <p> within that div the layout for all the pages are the same so is there a easy way to basically just refresh that <div> with specific information than rather copying the layout for each page and making a page for each set of information, (eg Home page with its info on and you click on about us i want the about us info to display in the <div> block without creating a whole new page

any help will be appreciated thanks
wes
Posted
Updated 23-Aug-12 1:45am
v2
Comments
Anuja Pawar Indore 23-Aug-12 7:46am    
Removed code block
Member 9377075 24-Aug-12 4:37am    
thanks i went for the ajax method and just reloading the div works just fine thanks for the help

If I have understood you correctly,

Use master page and put the div inside that. In that case, all the pages that iherits the master page will have the div. So, you don't need to put the div in all the pages.

Now, you need to update the innerhtml of the div.
If the content of the div is changed often, you need to store the text (along with html, if you need) to database.

In master page_load, check which page you are in, call the database and get the actual text and assign it in div.

You can even use ajax to do it, but if it is in page_load and one time load only, I don't see any substantial benefit using ajax here.

OR

If your text is fixed, you can use hidden fields in master page to store the text for all pages using some delimiter. Thus you don't need a round trip of server call and enhance site performance. Though this approach has cons: if your text is too large, no need to make your page heavier by storing text in hidden field. I would suggest to use database for persistent storage.

Another approach is to store your text in custom xml. This is a better approach.

Hope this helps.
cheers
 
Share this answer
 
v2
Comments
I.explore.code 23-Aug-12 10:18am    
MasterPages are the way to go! my 5!
Use JQuery to make an AJAX call and populate your div.

Here[^] is an example.
 
Share this answer
 

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