Stopping a master page when switching between pages?

I use the main page in my ASP.net application, on the main page I put the ContentPlaceHolder in the update panel to support AJAX on child pages, the question is how to stop updating the "basic page settings" when navigating between pages

To navigate between pages, I tried using Response.Redirect, windows.location java script without success, should I use Frames or IFrames instead of Master Pages to stop Refreshing?

Any suggestion to solve this problem will be highly appreciated, thanks in advance ...

+7
ajax master-pages
source share
3 answers

If you do not want the page to refresh when switching between "pages", you will not have a good solution using the main page. As other words have said, the main page is simply a "template" used by different pages. Navigating between them is similar to calling different pages and, of course, will reload the entire page, including the contents of the main page.

  • The solution I used with Ajax is to have each "page" as a control user and put them in the UpdatePanel with visible="false" . Then, to navigate between the "pages", a visibility switch for user controls to display the correct "page" control.

  • An alternative is to use an iframe.

None of these solutions use MasterPage.

The concept of MasterPage was designed to simplify the overall look before Ajax was introduced in ASP.NET. After Ajax became popular, demand for a non-refreshing whole page was more common.

+5
source share

A master page is nothing more than a default extension of your โ€œregularโ€ page (in most cases) for your application. The main page and content owners are displayed as a full html page. When you navigate between pages, this is normal behavior that refreshes your entire page. This is how the Internet works.

Working with iframes may solve your problem. However, this has some other side effects:

  • The entire main page is no longer needed. The content around your iframe is the "main page".

  • With the main page, you are actually viewing a different URL, you also see the URL bar of your browser in the line. When you work with an iframe, you move inside the iframe to another page. Your browser url will not change. When the user of your application gets to the refresh button, it always starts again on the default page that you assigned to your iframe in html. Of course there are some workarounds

Anyway. It really depends on your application. There are several solutions for working with the update.

+2
source share

Having a structure like the one you explained:

  • Master
    • Baby page 1
    • Baby page 2
    • ...

Then you cannot prevent the page from updating when switching from page 1 to page 2, etc., since you have a single โ€œpageโ€ object (main content + selected page content) when it is displayed in the browser.

If you want to switch between different types of applications inside the same page (to prevent a full page refresh), you could use one page (the Wizard becomes completely useless) with the updatePanel, in which you load different types.

You can also use iFrames, but if you need to handle any type of connection between different parts of the page (some of which are inside iFrames), I personally advise you not to use them.

+1
source share

All Articles