3
Reply

What are the advantages of using Master Pages?

Sapna Malik

Sapna Malik

15y
13.2k
0
Reply

    Here is a look at some of the benefits of using Master pages for your next website or web application.1. Centralized Updating The common code for the functionality of your pages can be stored in the master page's code behind, making coding and updates much easier.2. Common Controls How many times have you had to change menu layouts or drop down items. Placing server controls inside the Master page means you only have to edit the control in one location.3. Flexibility The Master page object model allows you to make changes to the master page from individual content pages. This allows fine grained control over the rendering of the final page.4. Enhanced User Experience Since all content pages are injected with the same master page controls, your interface will be more consistent and will provide a more consistent look and feel.5. Site Management Master pages improves site management because you're loading and having to work on fewer modules in your IDE. Making changes to your application may not require you to load any content pages.Depending on the nature of your application, your child pages may just be simple containers for HTML elements and data and may not require any code behind whatsoever.6. Less Code Content pages are much easier to work with since they really don't have to contain any code whatsoever. A simple web app may only require code in its masterpage.master class only.With less than 10 lines of code in your master page, you can inject data from a database or XML file directly in to your content pages. Theoretically, this means even a 300 page website may only require a couple dozen lines of code. This makes your content pages really nothing more than empty containers that work as bookmarks for SEO juice.7. Less Storage Requirements Since most of your UI code can be put in the same masterpage, your content pages will be considerably smaller.Depending on the complexity and size of your app, you may find storage requirements not to be much of a concern, especially with terabytes of cheap server space so readily available these days.

    Very good covered by pradeep.

    Also it is very usefull when you want different MasterPages for different rols.
    Suppose in any college websites you can design Different Master Pages for "Teacher" as well as Students and for others.

    1. They allow you to centralize the common functionality of your pages so that you can make updates in just one place.
    2. They make it easy to create one set of controls and code and apply the results to a set of pages. For example, you can use controls on the master page to create a menu that applies to all pages.
    3. They give you fine-grained control over the layout of the final page by allowing you to control how the placeholder controls are rendered.
    4. They provide an object model that allows you to customize the master page from individual content pages.