jw970170
Programmer
- Aug 8, 2005
- 38
Hello,
I have found an 'easy' tutorial for setting up web templates ( but cannot get it to work. Any ideas?
Here is my code. I think the mistake is some obvious little thing
------------------------TPage.vb------------------------
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Public Class TPage : Inherits System.Web.UI.Page
Dim Form As HtmlForm = New HtmlForm
Protected Overrides Sub CreateChildControls()
Me.Controls.Add(Me.Form)
Dim main As Control = Me.FindControl("Main")
If IsDBNull(main) Then
Me.Form.Controls.Add(main)
End If
MyBase.CreateChildControls()
End Sub
Protected Overrides Sub Render(ByVal Output As HtmlTextWriter)
Output.Write("<html> <head><title>[Website Title]</title> </head><body>fdghdghd")
' Render the page contents.
MyBase.Render(Output)
' Render the end HTML.
Output.Write("</body></html>")
End Sub
End Class
--------------------Webform1.aspx-------------------------
<%@ Page %>
<!-- Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Page.WebForm1"> -->
<asp
anel ID=”Main”> <BR>add your page specific content here...
<BR>notice the ID of the panel <BR></asp
anel>
--------------------Page.aspx.vb-------------------------
Public Class Page : Inherits TPage
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
End Class
I have found an 'easy' tutorial for setting up web templates ( but cannot get it to work. Any ideas?
Here is my code. I think the mistake is some obvious little thing
------------------------TPage.vb------------------------
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Public Class TPage : Inherits System.Web.UI.Page
Dim Form As HtmlForm = New HtmlForm
Protected Overrides Sub CreateChildControls()
Me.Controls.Add(Me.Form)
Dim main As Control = Me.FindControl("Main")
If IsDBNull(main) Then
Me.Form.Controls.Add(main)
End If
MyBase.CreateChildControls()
End Sub
Protected Overrides Sub Render(ByVal Output As HtmlTextWriter)
Output.Write("<html> <head><title>[Website Title]</title> </head><body>fdghdghd")
' Render the page contents.
MyBase.Render(Output)
' Render the end HTML.
Output.Write("</body></html>")
End Sub
End Class
--------------------Webform1.aspx-------------------------
<%@ Page %>
<!-- Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="Page.WebForm1"> -->
<asp
<BR>notice the ID of the panel <BR></asp
--------------------Page.aspx.vb-------------------------
Public Class Page : Inherits TPage
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
End Class