Placeholder, placeholder ......
Blog placeholder is something we want to do but cannot do. Today, I saw a sentence: "My life has no placeholder ." I am very domineering, but today I want to sing a reverse tone to fight for the placeholder.
1 Introduction:
The master can be used to create a consistent layout for the web page. When used, the master page defines the desired appearance and standard behavior for the webpage, and then creates various content pages to contain the displayed content based on the master page. When a user requests a content page, these content pages will be merged on the master page, so that the layout of the master page and the content of the content page can be combined for output. All the appearances and behaviors defined on the master page are displayed on the content page, but the content page also has its own characteristics. These features
2 advantages:
(1) You can use the master page to process the general functions of a webpage in a centralized manner. To modify the general functions of all webpages, you only need to modify the master page.
(2) You can use the master page to easily create a group of controls and codes and apply them to a group of web pages.
(3) by allowing the display mode controlled by placeholders, the layout of the final page can be controlled on the master page in details.
3 components:
(1) Special Mark: @ Master
Mark this Page as a master Page, which is different from the @ Page command on a common Page.
(2) Top-level html elements
All top-level elements of a Web page, such
To use any html and asp.net elements on the master page.
(3) placeholder control -- ContentPlaceHolder
A placeholder control is a standard control of asp.net. Similar to the lable control, textbox Control, and Button control that we often use. Different controls have different functions. Placeholder controls are used for placeholder.
The master page summary can contain one or more placeholder controls that can replace content ContentPlaceHolder. During the operation, these placeholder controls define the area where the content to be replaced is rendered, and then define the replaceable content on the Content Page. Finally, these replaceable content will be displayed in the area where the placeholder control is defined.
4 Working Principle
<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + IDwvcD4KPGgyPjUgyr7A/aO6PC9oMj4KPHA + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20140124/20140124092505119.jpg" alt = "">
6. Conclusion: The relationship between the master page and the content page is like that between the parent class and the Child class. The subclass inherits the attributes and methods of the parent class. The parent class (master page) defines a virtual method of the ContentPlaceHolder type. The subclass (Content Page) to override the virtual method of the parent class, each content page can only have one method to override the method with the same name in the parent class.