ASP.NET Web Development – Master Page Design and Reloads

asp.netweb-development

Ive been building a website with 2 pages and 1 master page. The master master page works as a "Menu". The two pages inherits from the master page and have some content on them.

On Page1 I have a link to Page2. Once I click on the link Page2 (and master page) loads.

Pretty straight forward I guess. But my question is now:
The master page ofcourse reloads everytime I go to a new page and thereby the entire site "flicks" for short moment to switch to the next page. Is there some "best practice" for keeping the master page(the menu) on the page while only loading the content?

I still want to split the two pages up in Page1.aspx and Page2.aspx and not having all my content in 1 page with panels showing the content of page1 and another panel showing the content of page2 etc.
Should I use some sort of control that has the pages inside them or is this just a stupid question and I shouldnt be bothered by the entire page flicking as this is just normal "web behaviour"?

Hope you can help 🙂

Best Answer

You seem to be looking for a site the loads new data and updates the HTML directly - this is not how ASP.NET webforms work by default. When you go to a new page, it needs to load from scratch.

To achieve what you want, you would need to use AJAX to query the web server for the data/template and update the page.

Webforms can work this way - using the UpdatePanel and related classes and javascript.

Related Topic