I am trying to create a template for my website. But I have a problem, the
system says BC30469: Reference to a non-shared member requires an object
reference and points to the statement PageBase.Render ( writer ).
I create the template by overriding the System.Web.UI.P age.Render method.
Then in every page I refer to the designed template. Please explain to me
where I go wrong.
Look here for the live errormessage:
http://johnboers.europe.webmatrixhos.../template.aspx
I use two files, see below.
Thank you for your time,
John
The files
Template.aspx
---
<% @Page Language="VB" AutoEventWireup ="true" src="template.v b"
Inherits="PageB ase" %>
<form id="pagecontent " method="post" runat="server">
<B> the content in HTML </B>
It should appear.
</form>
---
and template.vb
---
Imports System
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Web.UI.H tmlControls
Public Class PageBase
inherits System.Web.UI.P age
protected overrides sub Render(writer as HTMLTextWriter)
' First we will build up the html document,
' the head section and the body section.
writer.Write( "<html><head><t itle>John's test
pagina</title></head><body>exam ple text" )
' Then we allow the base class to render the
' controls contained in the ASPX file.
PageBase.Render ( writer )
' Finally we render the final tags to close
' the document.
Writer.Write( "</body></html>" )
end sub
end class
---