- By Michael Halvorson
One Step Further: Setting Web Site Titles in Internet Explorer
Haven’t had enough yet? Here are two last Web programming tips to enhance your Web site and send you off on your own explorations.
You might have noticed while testing the Car Loan Calculator Web site that Internet Explorer displayed “Home Page” in the title bar and window tab when displaying your Web site. Your program also displays the very large template title “MY ASP.NET APPLICATION” at the top of the window. In other words, your screen looked like this:
You can customize what Internet Explorer and other browsers display in the title bar by setting the Title property of the DOCUMENT object for your Web page; and you can modify the “MY ASP.NET APPLICATION” string by editing the site master page. Give editing both values a try now.
Set the Title property
With the Default.aspx Web page open in Design view, click the DOCUMENT object in the Object list box at the top of the Properties window.
Each Web page in a Web site contains a DOCUMENT object that holds important general settings for the Web page. However, the DOCUMENT object is not selected by default in the Designer, so you might not have noticed it. One of the important properties for the DOCUMENT object is Title, which sets the title of the current Web page in the browser.
Set the Title property to “Car Loan Calculator.”
The change does not appear on the screen, but Visual Web Developer records it internally. Now, change the title of your application in the site master page.
Edit the master page title
Click the Site.Master file in Solution Explorer, and then click the View Designer button.
Visual Studio displays the master page in the Designer. The master page is a template that provides default settings for your Web site and lets you adjust characteristics such as appearance, banner titles, menus, and links. For example, you can click smart tags associated with the Web site’s menu items and adjust them much as you customized menus in Chapter 4, “Working with Menus, Toolbars, and Dialog Boxes.”
Your screen looks like this:
Delete the title “MY ASP.NET APPLICATION” and type TIME FOR A NEW CAR?
Visual Web Designer enters your new title. Now run the Web site again.
Click the Start Debugging button.
Visual Studio opens Internet Explorer and loads the Web site. Now a more useful title bar and banner message appears, as shown in the following screen shot:
Now that looks better.
Close Internet Explorer, and then update the Title properties for the other Web pages on your Web site.
When you’re finished experimenting with the Car Loan Calculator, save your changes and close Visual Studio.
Congratulations on completing the entire Microsoft Visual Basic 2010 Step by Step programming course! Take a few moments to flip back through this book and see all that you have learned. Now you’re ready for more sophisticated Visual Basic challenges and programming techniques. Check out the resource list in the Appendix, “Where to Go for More Information” for a few ideas about continuing your learning. But take a break first—you’ve earned it!