| |||||
HtmlAnchor Control SyntaxASP.NET Syntax ASP.NET Syntax for HTML Controls Defines the destination of a hypertext link, or designates a named location within a document. For information on the individual members of this class, see HtmlAnchor in the class library. Syntax Notes
Working with HtmlAnchorThe HtmlAnchor control is used to navigate from the client page to another page, or to another location within the same page. HtmlAnchor enables programming of the HTML <a> element. You can use this control to dynamically modify the attributes and properties of the <a> element, display hyperlinks from a data source, and control events to generate HtmlAnchor controls dynamically. The following samples illustrate use of the HtmlAnchor control. The following example shows how authors can dynamically generate the textual content of an HtmlAnchor control based on a given condition. In this case, the link text changes depending on whether the associated <img> control is visible or not.
The sample is implemented as follows.
The below example illustrates using the simple yet powerful databinding feature of ASP.NET. Databinding enables authors to dynamically generate hyperlinks on a Web Forms page using values from given fields in a data source. And when databinding is used within templates in list controls such as the <asp:Repeater>, <asp:DataGrid>, and <asp:DataList>, only a single declaration is needed to generate each hyperlink item in the list. Note that the method used in this sample not only generates the link text, but also the querystring parameter of the url, which determines what argument is passed along to each link.
The above example applies several concepts and methods that are described elsewhere in this workshop. For particulars, see ASP.NET Data Access Basics, Introduction to Data Binding in Web Forms, Web Forms Server Controls Templates. See Also |
| ||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme