Accessing the Header in ASP.NET 2.0

Last post 08-28-2007 2:00 PM by matharuajay. 1 replies.

Sort Posts:

  • Accessing the Header in ASP.NET 2.0

    08-28-2007, 1:43 PM
    • Member
      11 point Member
    • sunny.falcon
    • Member since 08-28-2007, 12:38 PM
    • Posts 10

    how do i acess the header in the page so that i can add the link tag dynamicaly to the page???

  • Re: Accessing the Header in ASP.NET 2.0

    08-28-2007, 2:00 PM
    Answer
    • Participant
      813 point Participant
    • matharuajay
    • Member since 02-27-2007, 2:50 AM
    • Posts 176
    Dim header As Web.UI.HtmlControls.HtmlHead
            header = TryCast(Me.Page.Header, Web.UI.HtmlControls.HtmlHead)
            If header IsNot Nothing Then
                Dim link As New HtmlLink
                link.Attributes.Add("href", "~/whatever.css")
                link.Attributes.Add("media", "screen")
                link.Attributes.Add("rel", "stylesheet")
                link.Attributes.Add("type", "text/css")
                header.Controls.Add(link)
            End If

     

    Known is handful and unknown is worldful.

    Regards,
    Ajay Matharu
    http://ajaymatharu.com
    http://twitter.com/matharuajay
Page 1 of 1 (2 items)