Re: asp.net page template *inheritance)

From: Marina (someone_at_nospam.com)
Date: 05/28/04


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
> ---



Relevant Pages

  • Re: Capricious Video playback with DShow
    ... If you're using XP and simply calling the IFilterGraph Render method on your ... The default XP renderer (VMR 7) appears to need some set-up that I'm not ... >> I've succeed in playing video into a window using DShow. ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: asp.net page template *inheritance)
    ... I have to use the render method of mybase, but I never declare or import ... MyBase so where is it defined? ... >> I create the template by overriding the System.Web.UI.Page.Render method. ... >> Imports System.Web.UI ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: custom control - doesnt show
    ... Imports System.Web.UI.WebControls ... Private Sub InitializeComponent() ... Protected Overloads Sub Render(ByVal render As HtmlTextWriter) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Returning calculation results from pixel shader
    ... (your gf6 card should allow that), render to ... and get it's data back by calling ... Thanks for the hint. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Cakephp & Smarty problem
    ... class SmartyView { ... and problem when calling this method (_render) it always returns white chars but template file is'nt empty ... do i have to set something in cakephp configuration or in php.ini? ...
    (comp.lang.php)