ASP.NET Tutoria...login
ASP.NET Tutorial
author:php.cn  update time:2022-04-11 14:18:18

HtmlAnchor control


ASP.NET HtmlAnchor Control


up.gif HTML server control

Definition and usage

HtmlAnchor control Controls the <a> element. In HTML, the <a> element is used to create hyperlinks. Hyperlinks can link to bookmarks or other web pages.


Attributes

AttributesDescription
AttributesReturn all attribute name and value pairs of the element.
DisabledBoolean value indicating whether to disable the control. The default is false.
HRefThe URL of the link.
idThe unique id of the control.
InnerHtmlSet or return the content between the opening tag and closing tag of this HTML element. Special characters are not automatically converted to HTML entities.
InnerTextSet or return all text between the opening tag and closing tag of this HTML element. Special characters are automatically converted to HTML entities.
NameThe name of the anchor.
OnServerClickThe name of the function that is executed when the link is clicked.
runat Specifies that the control is a server control. Must be set to "server".
StyleSets or returns the CSS properties applied to the control.
TagNameReturns the tag name of the element.
TargetThe target window to open.
TitleThe title displayed by the browser (such as the title attribute of the img element).
VisibleBoolean value indicating whether the control is visible.


Example

HTMLAnchor
In this example, we declared two HtmlAnchor controls in the .aspx file ( Remember to nest the control within the HtmlForm control). We then modify the URL, target, and title of the HtmlAnchor control in an event handler (an event handler is a subroutine that executes code for a given event). The Page_Load event is one of many events understood by ASP.NET.


up.gif HTML Server Control

php.cn