J
John Boers
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.Page.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.webmatrixhosting.net/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.vb"
Inherits="PageBase" %>
<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.WebControls
Imports System.Web.UI.HtmlControls
Public Class PageBase
inherits System.Web.UI.Page
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><title>John's test
pagina</title></head><body>example 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
---
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.Page.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.webmatrixhosting.net/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.vb"
Inherits="PageBase" %>
<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.WebControls
Imports System.Web.UI.HtmlControls
Public Class PageBase
inherits System.Web.UI.Page
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><title>John's test
pagina</title></head><body>example 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
---