Controls You Can Use on Web Forms ASP.NET Standard Controls HyperLink Control
HyperLink controls can render as text or as graphics.
- Declare an <
asp:HyperLink
> element on the page. For syntax, see Hyperlink Control Syntax.
- Specify the format of the link in the page by doing one of the following:
- Set the NavigateUrl property to the URL of the page to link to.
- Optionally, set the ID of a target window or frame to display the linked page in. You can either specify a window by name or you can use predefined target values such as _top, _parent, and so on.
TIP: You can change the appearance of the link text — for example, whether it is underlined — using styles.
The following shows how you can set the Hyperlink control’s link text and destination page at run time.
void Page_Load ( object src, EventArgs e ) {
Hyperlink1.Text = "Home";
Hyperlink1.NavigateURL = "/asp.net.ph";
}
Protect Sub Page_Load ( ByVal sender as Object, ByVal e as EventArgs )
Hyperlink1.Text = "Home"
Hyperlink1.NavigateURL = "/asp.net.ph"
End Sub |
|
C# |
VB |
Whilst the sample simply shows how the Text and NavigateUrl properties can be set as the page loads, you can extend this functionality by getting the values of these properties from user input, or passed from some other event-handling method.
Introduction to the HyperLink Control Web Forms Data Binding