Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cannot add to the head control
Message
De
05/10/2008 16:34:46
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Cannot add to the head control
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01352874
Message ID:
01352874
Vues:
75
I have this GetHeader() method which is called for every page and it inserts the proper header in the head control:
    Public Function GetHeader() As String
        Dim lcHeaderHttps As String = ""
        Dim loHead As System.Web.UI.HtmlControls.HtmlGenericControl = New System.Web.UI.HtmlControls.HtmlGenericControl()
        Dim loStringBuilder As StringBuilder = New StringBuilder()

        ' If we are under Https
        If lHeaderHttps Then
            lcHeaderHttps = oProcess.oApp.cHttps
        End If

        ' Put the BASE HREF in the head
        loHead = oProcess.oPage.FindControl("Head")

        loHead.InnerHtml = "<TITLE>" + oProcess.oApp.cTitle + "</TITLE>" + _
         "<BASE HREF=" + oProcess.oApp.cHttp + ">" + _
         "<link rel=""STYLESHEET"" href=""StyleSheet.css"" type=""text/css"">"

        ' If we want the header
        If lHeader Then
            loStringBuilder.Append("<A HREF=http://localhost/optic/Administration.aspx>Administration</A>")
            loStringBuilder.Append("<P>")
        End If

        Return loStringBuilder.ToString
    End Function
But, this is ok for as long as I do not have anything the head control already. But, in one specific page, we need to have some custom code in the head control. So, basically, this method will do its work but should also take in consideration to add the actual custom code of the head control. So, basically, on the loHead.InnerHtml line, I could simple replace the = sign with +=. But, when doing it, I have:

"Cannot get inner content of Head because the contents are not literal."

So, basically, I can initialize it but I cannot add to it.

Anyone would know what I should do?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform