Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code behind and include file
Message
De
20/05/2003 11:56:05
 
 
À
20/05/2003 11:32:04
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00790138
Message ID:
00790554
Vues:
17
I'm not helping much Randy <g> ... Web stuff isn't my strong point, but I think perhaps that article that I pointed you to still might help. The DynamicControlHost that he describes in the article would be what you'd put in place of the "page info" in your example. Play with it and see what you can come up with ...

~~Bonnie


>I will try to explain it a little better. I want to create a class contains the structure that all of my web pages will inherit. If you look at it in terms of a table it should look like this:
>
>
>table1 - one row with 2 data cells
>=====================================
>!             ! table 2 - 2 rows    !
>! side menu   !    one data cell    !
>!             !    a piece - Header !
>!             !=====================!
>!             !                     !
>!             !   page info         !
>!             !                     !
>=====================================
>
>
>All the pages will have the same structure, the only thing that should really change is the page info information. I thought this could be done in just a vb class. I tried to use the include file at first, but I know that is not how you do it now. Below is the code I am using:
>
>
>Imports System
>Imports System.Web.UI
>Imports System.Web.UI.WebControls
>Imports System.Web.UI.HtmlControls
>
>Public Class clsBaseSetup
>
>    Inherits Page
>
>#Region "Properties"
>    Private _pageTitle As String
>    Private _LeftSide As String = ""
>    Private _LDim As String = ""
>    Private _Top As String = ""
>    Private _TDim As String = ""
>    Private _Middle As String = ""
>    Private _MDim As String = ""
>
>    Public Property PageTitle() As String
>        Get
>            Return _pageTitle
>        End Get
>        Set(ByVal Value As String)
>            _pageTitle = Value
>        End Set
>    End Property
>
>    Public Property LeftSide() As String
>        Get
>            Return _LeftSide
>        End Get
>        Set(ByVal Value As String)
>            _LeftSide = Value
>        End Set
>    End Property
>    Public Property LeftSideDimension() As String
>        Get
>            Return _LDim
>        End Get
>        Set(ByVal Value As String)
>            _LDim = Value
>        End Set
>    End Property
>
>    Public Property Top() As String
>        Get
>            Return _Top
>        End Get
>        Set(ByVal Value As String)
>            _Top = Value
>        End Set
>    End Property
>    Public Property TopDimension() As String
>        Get
>            Return _TDim
>        End Get
>        Set(ByVal Value As String)
>            _TDim = Value
>        End Set
>    End Property
>
>    Public Property Middle() As String
>        Get
>            Return _Middle
>        End Get
>        Set(ByVal Value As String)
>            _Middle = Value
>        End Set
>    End Property
>    Public Property MiddleDimension() As String
>        Get
>            Return _MDim
>        End Get
>        Set(ByVal Value As String)
>            _MDim = Value
>        End Set
>    End Property
>#End Region
>
>    Overridable Sub Page_Load()
>        Me.PageTitle = "Randy Belcher"
>        Me.LeftSide = "maintoolbar.ascx"
>        Me.LeftSideDimension = " width=190 height=100%"
>    End Sub
>
>    Protected Overrides Sub CreateChildControls()
>
>        ' Add Opening HTML Tags
>        Dim strOpenHTML As String
>        strOpenHTML = _
>        "<%@ Register TagPrefix=""Left"" TagName=""LS"" Src=""" & me.LeftSide & """   " & _
>            "<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  " & _
>                        "<Left:LS id=""pgemaintool"" Runat=""Server"" />" & _
>                    "</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
>
>
>
>I figured by changing the ascx file in the page_load, i could change the content that would be on the page. So the only thing I would need in my aspx page would be:
>
>
><%@ Page inherits="clsBaseSetup" src="clsBaseSetup.vb"  
><Script Runat="Server">
>Overrides Sub Page_Load
>  mybase.page_load
>  me.leftside = "Different.ascx"
>End Sub
></Script>
>
>
>Maybe I am way off track, but I hope this is a better explanation.
>
>Thanks for the help.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform