Displaying the E-Mail Address as a Mailto Hyperlink

Recall from Hour 22, “Allowing Users to Add Guestbook Entries,” that when entering a guestbook entry, a user can optionally provide an e-mail address. In Hour 23, “Displaying the Guestbook's Contents,” we displayed this e-mail address, if provided, in the guestbook entry listing (see Figure 24.1).

Figure 24.1. The user's e-mail address, if provided, is displayed.

Rather than just displaying the user's e-mail address as text, it would be nice to display the e-mail address as a mailto hyperlink, which is a hyperlink that has the form

<a href="mailto:emailAddress">emailAddress ...

Get SAMS Teach Yourself ASP.NET in 24 Hours 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.