08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

62<br />

CHAPTER 3 ■ WEB FORMS WITH <strong>ASP</strong>.<strong>NET</strong><br />

Figure 3-6. Using the Page.Controls collection<br />

Accessing the Page Head<br />

If you look closely at Figure 3-6, you’ll see that the HTMLHead of the page is listed as one of<br />

the controls on this page. You can see the reason for this if you look back at Listing 3-11,<br />

where the tag has a runat="server" attribute set.<br />

This enables you to set HTML page attributes from the server dynamically so that<br />

you can, for example, set the attributes of the HTML header from within your code. For<br />

example, the page title can be set quite simply. (Note that this technique is identical to<br />

what you saw for accessing the <strong>ASP</strong>.<strong>NET</strong> HTML control properties with the add/subtract<br />

application.)<br />

First, make sure that the tag has an ID, like this:<br />

<br />

Untitled Page<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!