HtmlLink Class

Allows programmatic access to the HTML link element on the server.

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in system.web.dll)

public ref class HtmlLink : public HtmlControl
public class HtmlLink extends HtmlControl
public class HtmlLink extends HtmlControl
Not applicable.

The HtmlLink control allows programmatic access to the HTML link element on the server. The HtmlLink control can be used to programmatically specify a cascading style sheet (CSS) reference in a Web page.

The following code example demonstrates using the HtmlLink control to programmatically add a style sheet to a Web page.

No code example is currently available or this language may not be supported.

To run the preceding code example, you need a cascading style sheet (CSS) named Stylesheet.css, containing the following code, saved in the same directory as your Web site.

body {
  padding-left: 11em;
  font-family:  Verdana, "Times New Roman",
        Times, serif;
  color: blue;
  background-color: silver }
h1 {
  font-family: Helvetica, Geneva, Arial,
        SunSans-Regular, sans-serif; 
  color: purple }
body {
  padding-left: 11em;
  font-family:  Verdana, "Times New Roman",
        Times, serif;
  color: blue;
  background-color: silver }
h1 {
  font-family: Helvetica, Geneva, Arial,
        SunSans-Regular, sans-serif; 
  color: purple }

  • AspNetHostingPermission  for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
  • AspNetHostingPermission  for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.

System.Object
   System.Web.UI.Control
     System.Web.UI.HtmlControls.HtmlControl
      System.Web.UI.HtmlControls.HtmlLink

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: