MasterPage is a new asp.net in the 2.0. Has the following advantages:
1. Master pages can be used to centralize the common functionality of a page so that updates can be made only in one location.
2. Using master pages makes it easy to create a set of controls and code and apply the results to a set of pages. For example, you can use a control on a master page to create a menu that applies to all pages.
3. By allowing you to control how placeholder controls are rendered, master pages allow you to control the layout of the final page in detail.
4. The master page provides an object model that you can use to customize the master page from individual content pages.
In the actual use of the content page and masterpage between the exchange of data. The following is an introduction to how data is delivered.
1, add the following statement to the content page
<%@ MasterType virtualpath= "~/masterpage.master"%>
The virtualpath value is the path of the Matermage
2, the method of defining public in Materpage
public void SetValue (string s)
{this
. Label1.Text = s;
Public
String GetValue () {return this
. Label1.Text;
}
The SetValue method is used to pass data to masterpage from a content page.
The GetValue method is used to pass data to a content page from MasterPage.