Export (0) Print
Expand All

HtmlLink Constructor

Initializes a new instance of the HtmlLink class.

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


Use this constructor to create and initialize a new instance of the HtmlLink control.

The following code example demonstrates how to programmatically declare an HtmlLink control and define its properties. For a complete, working code example, see the HtmlLink class overview topic.

Partial Class HtmlLinkvb_aspx

    Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)

        ' Create an instance of HtmlLink. 
        Dim myHtmlLink As HtmlLink = New HtmlLink()
        myHtmlLink.Href = "StyleSheet.css"
        myHtmlLink.Attributes.Add("rel", "stylesheet")
        myHtmlLink.Attributes.Add("type", "text/css")

        ' Add the instance of HtmlLink to the <HEAD> section of the page.

    End Sub 

End Class
No code example is currently available or this language may not be supported.
// Define an HtmlLink control.
HtmlLink myHtmlLink = new HtmlLink();
myHtmlLink.Href = "~/StyleSheet.css";
myHtmlLink.Attributes.Add("rel", "stylesheet");
myHtmlLink.Attributes.Add("type", "text/css");

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft