Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code behind and include file
Message
De
19/05/2003 16:00:14
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Code behind and include file
Divers
Thread ID:
00790138
Message ID:
00790138
Vues:
48
Hello all, I am trying to learn how to setup a template page that all other pages in my website can inherit from. Can anyone tell me why using
<!-- include file = "toolbar.htm" -->
does not work using the code below? If I take out the include and just put some text in it works fine. The inheritant aspx page just has the following code:
Page inherits="clsBaseSetup" src="clsBaseSetup.vb"

Thanks for the help.
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls

Public Class clsBaseSetup

    Inherits Page

    Protected Overrides Sub CreateChildControls()

        ' Add Opening HTML Tags
        Dim strOpenHTML As String
        strOpenHTML = _
            "<html>" & _
                "<head>" & _
                    "<title>" & PageTitle & "</title>" & _
                "</head>" & _
                "<body>"
        Controls.Add(New LiteralControl(strOpenHTML))

        ' Add Base Setup HTML Tags
        Dim strBaseHTML As String
        strBaseHTML = _
            "<table ID=""Table1"">" & _
                "<tr>" & _
                    "<td width=190 height=100  " & _
                        "<!--#include file=""toolbar.htm""-->" & _
                    "</td>" & _
                    "<td>" & _
                        "<table ID=""Table2"">" & _
                            "<tr>" & _
                                "<td>" & _
                                    "TABLE 2 ROW 1 DATA CELL 1" & _
                                "</td>" & _
                            "</tr>" & _
                            "<tr>" & _
                                "<td>" & _
                                    "TABLE 2 ROW 2 DATA CELL 1" & _
                                "</td>" & _
                            "</tr>" & _
                        "</table>" & _
                    "</td>" & _
                "</tr>" & _
            "</table>"
        Controls.Add(New LiteralControl(strBaseHTML))

        ' Add Closing HTML Tags
        Dim strCloseHTML As String
        strCloseHTML = _
                "</body>" & _
        "</html>"
        Controls.Add(New LiteralControl(strCloseHTML))

    End Sub

End Class
Randy Belcher
AFG Industries, Inc.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform