One Step Further: Setting the Web Site Title in Internet Explorer


One Step Further: Setting the Web Site Title in Internet Explorer

Haven't had enough yet? Here's one last Web programming tip 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 “Untitled Page” in the title bar when displaying your Web site. In other words, your screen looked like this:

graphic

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. Give it a try now.

Set the Title property

  1. With the Default.aspx Web page open in Design mode, click the Document object in Object list box 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.

  2. Set the Title property to “Car Loan Calculator”.

    The change does not appear on the screen, but Visual Web Developer records it internally.

  3. Click the Start Debugging button.

    Visual Studio opens Internet Explorer and loads the Web site. Now a more useful title bar appears, as shown in the following illustration:

    graphic

    Now that looks better.

  4. Close Internet Explorer, and update the Title properties for the other Web pages in your Web site.

  5. 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 2005 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 Appendix A, “Where to Go For More Information,” for a few ideas about continuing your learning. But take a break first—you've earned it!


Chapter 20 Quick Reference

To

Do this

Create a new ASP.NET Web site

Click the New Web Site command on the File menu, click ASP.NET Web Site, specify a folder location in the Location list box, and then click OK.

Switch between Design mode and Source mode in the Web Page Designer

Click the Source or Design tabs in the Designer.

Enter text on a Web page

Click the Design tab, and then type the text you want to add.

Format text on a Web page

On the page, select the text that you want to format, and then click a button or control on the Formatting toolbar.

View the HTML code in your Web page

Click the Source tab in the designer.

Add controls to a Web page

Display the Web page in Design mode, open the Toolbox (which automatically contains Visual Web Developer controls), position the insertion point where you want to place the control on the page, and then double-click the control in the Toolbox.

Change the name of an object on a Web page

Use the Properties window to change the object's ID property to a new name.

Write an event procedure for an object on a Web page

Double-click the object to display the code-behind file, and write the event procedure code for the object in the Code Editor.

Verify the format of the data entered by the user into a control on a Web page

Use one or more validator controls from the Validation tab of the Toolbox to test the data entered in an input control.

Run and test a Web site in Visual Studio

Click the Start Debugging button on the Standard toolbar. Visual Studio builds the project and loads the Web site in Internet Explorer.

Create an HTML page for a project

Click the Add New Item command on the Website menu, and then add the new HTML page to the project. Create and format the HTML page by using the Web Page Designer.

Create a link to other Web pages on your Web site

Add a HyperLink control to your Web page, and then set the control's NavigateUrl property to the address of the linked Web page.

Display database records on a Web page

Add a GridView control to a Web page in the Web Page Designer. Establish a connection to the database and format the data by using commands in the GridView Tasks list box. (The Choose Data Source command launches the Data Source Configuration Wizard.)

Set the title displayed for Web pages on the Internet Explorer title bar

For each Web page, use the Properties window to set the Document object's Title property.