Re: asp.net page template *inheritance)
From: Marina (someone_at_nospam.com)
Date: 05/28/04
- Next message: A.M: "RegularExpressionValidator doesn't ignore case"
- Previous message: Nicolas Beunier: "Re: HttpHandler and Session Issue"
- In reply to: John Boers: "asp.net page template *inheritance)"
- Next in thread: jobo: "Re: asp.net page template *inheritance)"
- Reply: jobo: "Re: asp.net page template *inheritance)"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 May 2004 15:55:51 -0400
This doesn't compile, because Render is an instance method - you were
calling it by using the class name: 'PageBase'.
If this did even compile and run - you would get a stackoverflowexception -
because you would constantly be calling the same method - the one you are
in!.
You want to call MyBase.Render(writer) - 'MyBase' is the keyword to refer to
the base class in VB.
"John Boers" <jj.boers@hccnet.nl> wrote in message
news:1x60df94o3eir.3b7lhfkwfhhh.dlg@40tude.net...
> 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
> ---
- Next message: A.M: "RegularExpressionValidator doesn't ignore case"
- Previous message: Nicolas Beunier: "Re: HttpHandler and Session Issue"
- In reply to: John Boers: "asp.net page template *inheritance)"
- Next in thread: jobo: "Re: asp.net page template *inheritance)"
- Reply: jobo: "Re: asp.net page template *inheritance)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|