1. When a master is used, the content control must one-to-one match with the contentplaceholder control on the master page.
2. If the contentplaceholder control of the master page has the default content and the content page does not have the content control, the content of the master page is displayed. Otherwise, the default content on the master page is not displayed even if the content control is empty.
3. If the content page needs to interact with a control on the master page (similar to other interactions), follow these steps:
1) In the master page classCodeCreate a public attribute. Its get and set correspond to the value of the control. (If the master page has a control ID of masterlbl)
Public StringMasterlbl {Get{ReturnMasterlbl. Text ;}Set{Masterlbl. Text =Value ;}}
2) You can call the following in the content page class:
(Mymaster) Master). masterlbl ="Test";
Here, the master is an object of the master class. You need to convert it to the corresponding master Type for interaction! Of course there are other methods, but this method is the most convenient. In this way, you can modify the masterlbl value of the Master Control.
4. The master and master can be nested. When nesting, the Child-master page must have the same content control as the content page and the parent page. When using the content page of the Child master page, you do not need to have the content control to correspond to the previous master page, as long as it corresponds to the contentplaceholder control of its own master page. If the child version has the contentplaceholder control, it must be placed in the content control corresponding to the parent version, as shown below:
< ASP: Content ID = "Content2" Contentplaceholderid = "Contentplaceholder1" Runat = "Server" > < ASP: contentplaceholder Runat = "Server" ID = "Contentplaceholder2" > </ ASP: contentplaceholder > </ ASP: Content >
The content page mainly corresponds to contentplaceholder2!
5. Relative Path of the master page
Assume that the master page contains an image
<IMGSRC= "T.jpg" />
If the master and image are in the same level of directory and the content page are different from the image, the image cannot be displayed because the image address is replaced by the content page with the address of the relative content page.
Solution:
1) use the full path <% = resolveurl ("~ /Scripts/jquery-1.4.1.min.js ") %> (BEST)
2) use server controls instead (JS and CSS non-controls cannot be solved)