A.6. Chapter 6
A.6.1.
A.6.1.1.
A.6.1.1.1. Exercise 1 solution
The ContentPlaceHolder element should be placed in the master page. It defines a region that content pages can fill in. The Content control should be placed in a content page that is based on the master page. It is used to supply the content for the ContentPlaceHolder element that it is connected to.
A.6.1.1.2. Exercise 2 solution
To link a Content control to its ContentPlaceHolder in the master page, you need to set the ContentPlaceHolderID:
<asp:Content ID="Content1" ContentPlaceHolderID="IdOfContentPlaceHolder" Runat="Server"> </asp:Content>
A.6.1.1.3. Exercise 3 solution
There are a few ways to do this. First, you can create a named skin with a different CSS class in the same skin file. You then hook up this named skin to the control you want to change:
<asp:Button runat="server" SkinID="RedButton" CssClass="RedButton" />
The Button control in the ASPX page should then set the SkinID to RedButton:
<asp:Button ID="Button1" runat="server" Text="Button" SkinID="RedButton" />
Alternatively, you can disable theming on the Button control and give it a different CSS class directly in the ASPX page:
<asp:Button ID="Button1" runat="server" EnableTheming="False" CssClass="RedButton" Text="Button" />
In both solutions, you need a CSS class that sets the background color:
.RedButton { background-color: Red; }
A.6.1.1.4. Exercise 4 solution
A StyleSheetTheme is applied early in the page's life cycle. This gives controls ...
Get Beginning ASP.NET 3.5: In C# and VB now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.