Skip to Content
Beginning ASP.NET 3.5: In C# and VB
book

Beginning ASP.NET 3.5: In C# and VB

by Imar Spaanjaars
March 2008
Intermediate to advanced content levelIntermediate to advanced
766 pages
21h 15m
English
Wrox
Content preview from Beginning ASP.NET 3.5: In C# and VB

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET 4: in C# and VB

Beginning ASP.NET 4: in C# and VB

Imar Spaanjaars
Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Bill Evjen, Scott Hanselman, Devin Rader

Publisher Resources

ISBN: 9780470187593Purchase book