Skip to main content

Posts

Showing posts from June, 2011

ASP.Net DotNetNuke Page Header Head/Meta Tags

Adding meta, css and script tag to the header proved to be too much trial and error. And searching online results in no clear solution either.

My custom requirement was for DotNetNuke Module to add css and script tag at page level head tag not inside the body tag.

Here is the simple solution:
In my view.ascx.vb file, I have added a prerender block of script:


Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender

Try
    Dim htmlHeadTags As String
    Dim htmlHeadCtrl As LiteralControl = New LiteralControl

    htmlHeadTags = "<meta name=""viewport"" content=""initial-scale=1.0, user-scalable=no"" />" _
& "<link href=""http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.12/themes/flick/jquery-ui.css"" rel=""stylesheet"" type=""text/css""/>" _
& "<link id=""ServiceCenterCSS"" rel=&qu…