How to: Add HyperLink Web Server Controls to a Web Forms Page (Visual Studio)
You can add a hyperlink to your Web Forms page by placing aWeb server control on the page and associating it with a URL. You can specify that HyperLink controls render as either text or as graphics.
To add a HyperLink Web server control to a Web Forms page
From the Standard tab of the Toolbox, drag a HyperLink control onto the page.
In the Appearance category of the Properties window, specify the format of the link on the page by doing one of the following:
To create a text link, set the control'sproperty. You can include HTML formatting in the property. For example, you can format an individual word in the text as bold by placing a <B> tag around it in the Text property.
To create a graphical link, set the control'sproperty to the URL of a .gif, .jpg, or other Web graphic file.
If you set both the ImageUrl and Text properties, the ImageUrl property takes precedence.
In the Navigation category of the Properties window, set theproperty to the URL of the page to which you want to link.
The URL that is associated with a hyperlink points to an external resource. If you point to a resource that you do not own, be sure it is safe for your users to work with. For more information, see.
Optionally, in the Navigation category of the Properties window, specify the target by setting the ID of a target window or frame in which to display the linked page. You can either specify a window by name or use predefined target values, such as _top, _parent, and so on.
You can change the appearance of the link text — for example, whether it is underlined — by using styles. For details, see.
The following example shows how you can set the properties of a HyperLink control at run time. The method handles acontrol's event and sets the control's link text and target page.
Protected Sub Button1_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Hyperlink1.Text = "Home" Hyperlink1.NavigateUrl = "http://www.microsoft.com/net/" End Sub