Newsgroup: it.comp.www.asp
Titolo: PageBaseClass

Ho creato una classe ereditata da Page per definire il layout di pagina e una pagina
che viene ereditata dalla mia classe PageBaseClass. 
Nella generazione con VS.Net non ci sono errori ma all'esecuzione la pagina h completamente
vuota. 
Qualcuno pur aiutarmi? 
Stefano, Andrea e Dino hanno gi` parlato di questo nel post: 
http://www.ugidotnet.org/forum/b.asp?m=3073
 
ho letto i link suggeriti ma non riesco a capire dove sia il problema. 
Questo h il codice: 
___________________ 
PAGEBASE CLASS 
Imports System 
Imports System.Web.UI 
Imports System.Web.UI.WebControls 
Public Class clsPageTemplate : Inherits Page 
Private phTitle As PlaceHolder = New PlaceHolder() 
Public phHeader As PlaceHolder = New PlaceHolder() 
Public phBody As PlaceHolder = New PlaceHolder() 
Public phFooter As PlaceHolder = New PlaceHolder() 
Public WriteOnly Property propTitle() As String 
Set(ByVal Value As String) 
phTitle.Controls.Clear() 
phTitle.Controls.Add(New LiteralControl(Value)) 
End Set 
End Property 
Private Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) 
AddStaticText("<html>" & "<head>" & "<title>") 
Controls.Add(phTitle) 
AddStaticText("</title>" & "</head>" & "<body>") 
AddStaticText("<table border='1' width='100%' height='100%'>") 
AddStaticText("<tr>") 
AddStaticText("<td align='center' height='20'>") 
Controls.Add(phHeader) 
AddStaticText("</td>") 
AddStaticText("</tr>") 
AddStaticText("<tr>") 
AddStaticText("<td align='center' valign='top'>") 
Controls.Add(phBody) 
AddStaticText("</td>") 
AddStaticText("</tr>") 
AddStaticText("<tr>") 
AddStaticText("<td align='center' height='20'>") 
Controls.Add(phFooter) 
AddStaticText("</td>") 
AddStaticText("</tr>") 
AddStaticText("<table") 
AddStaticText("<body>" & "<html>") 
End Sub 
Private Sub AddStaticText(ByVal output As String) 
Controls.Add(New LiteralControl(output)) 
End Sub 
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As EventArgs) 
If phFooter.Controls.Count = 0 Then 
phFooter.Controls.Add(New LiteralControl("Copyright 2001 - " & Year(Today).ToString()
& " - Nautes s.r.l.")) 
End If 
End Sub 
End Class 
-------- 
WEBFORM1.aspx.vb 
Imports System 
Imports System.Web.UI 
Public Class WebForm1 : Inherits PageBaseClass 
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load 
MyBase.propTitle = "ExcuseWare - Excuse List" 
MyBase.phHeader.Controls.Add(New LiteralControl("<h3>ExcuseWare - Always " & "a
reason</h3>")) 
MyBase.phBody.Controls.Add(LoadControl("wucList.ascx")) 
End Sub 
End Class 
--------- 
WEBFORM1.aspx 
&lt;%@ Page Language="vb" Codebehind="WebForm1.aspx.vb" Inherits="Template1.WebForm1"%>
--------- 
Nel controllo ho un datalist con un bottone
--
Enjoy the .NET community! ASPItalia.com
 
http://forum.aspitalia.com/
 
http://www.aspitalia.com/

Ho fatto un passo avanti, nessuno si fa avanti?
Avevo degli errori sul codice ora l'ultimo problema h che la pagina processata
non contiene la tabella creata.
Ecco il nuovo codice:
___________________ 
PAGEBASE CLASS 




AddStaticText("</table") 
AddStaticText("</body>" & "</html>") 
End Sub 
Private Sub AddStaticText(ByVal output As String) 
Controls.Add(New LiteralControl(output)) 
End Sub 
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As ventArgs)
If phFooter.Controls.Count = 0 Then 
phFooter.Controls.Add(New LiteralControl("Copyright 2001 - " & Year(Today).ToString()
)) 
End If 
End Sub 
End Class 
-------- 
WEBFORM1.aspx.vb 
Imports System 
Imports System.Web.UI 
Public Class WebForm1 : Inherits PageBaseClass 
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load 
MyBase.propTitle = "ExcuseWare - Excuse List" 
MyBase.phHeader.Controls.Add(New LiteralControl("<h3>ExcuseWare - Always" & "a
reason</h3>")) 
MyBase.phBody.Controls.Add(LoadControl("wucList.ascx")) 
End Sub 
End Class 
--------- 
WEBFORM1.aspx 
<%@ Page Language="vb" Codebehind="WebForm1.aspx.vb" Inherits="Template1.WebForm1"
 AutoEventWireup="False"%>
