7.4. The HyperLink Control: Linking to Other Pages

One common task we need to provide for is that of navigating links to other pages, both third-party Web links, such as http://www.amazon.com, and other ASP.NET pages in our project. We do this with the HyperLink control, setting its NavigateUrl property to either a URL or another page. The Text property displays the description of the link—for example, See Margaret & Nancy at Recital! is the text of a HyperLink control in Figure 7.1.

The NavigateUrl string can be any valid Web location. For example, the NorthWind link displays a Renoir painting of a piano recital currently available at

http://www.ibiblio.org/wm/paint/auth/renoir/renoir.filles-piano.jpg

Alternatively, if we click to the right of the NavigateUrl property, a file dialog box pops open displaying the contents of our project directory. We can select any of the project Web pages—for example,

NavigateUrl       WebForm2.aspx

We can represent the HyperLink control by an image rather than through its Text property by setting the ImageUrl property. If both are set, the ImageUrl property takes precedence and the text is not displayed. If the image is unavailable, the text in the Text property is displayed. If the ToolTip property is left blank, the Text property is treated as the text of the tool tip as well.

The Target property specifies the target window within which to display the page. If we leave it blank, the currently active window is the target. To display the page in a new browser window, we select _blank from the drop-down menu.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.5.57