473,946 Members | 3,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net page template *inheritance)

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
---
Nov 18 '05 #1
2 1484
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 stackoverflowex ception -
because you would constantly be calling the same method - the one you are
in!.

You want to call MyBase.Render(w riter) - 'MyBase' is the keyword to refer to
the base class in VB.

"John Boers" <jj******@hccne t.nl> wrote in message
news:1x******** *************** *****@40tude.ne t...
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
---

Nov 18 '05 #2
Thanks it works but..... I don't understand why.
I have to use the render method of mybase, but I never declare or import
MyBase so where is it defined?

Perhaps I need some more documentation of the object model, do you know a
good source or tutorial.

John

On Fri, 28 May 2004 15:55:51 -0400, Marina wrote:
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 stackoverflowex ception -
because you would constantly be calling the same method - the one you are
in!.

You want to call MyBase.Render(w riter) - 'MyBase' is the keyword to refer to
the base class in VB.

"John Boers" <jj******@hccne t.nl> wrote in message
news:1x******** *************** *****@40tude.ne t...
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
---

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3004
by: Gandu | last post by:
Could some C++ guru please help me. I have a template based general linked list class that I want to inherit publicly to create a queue class. In the case of non-template inheritance, I can use: class A{ }; class B: public A{}; And for the constructor of B: B:B():A(){} now suppose I have a template as:
1
1500
by: suzy | last post by:
hi, i have created a aspx page template by creating a template.cs file which inherits from the page class. In this file I override the OnInit event and create a template in the form of a header, left menu and a footer. there is also a body area where the main content of the page will go. i created these 4 areas by dynamically creating a placeholder in each area at runtime. in the template.cs i load user controls into each area...
0
1906
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
1
1161
by: Yoramo | last post by:
I'm using a page template and I would like some of my components to be user controls. where do i put the declaration for the User control (there is no aspx file only a C# file)? something like the line bellow: <%@ Register TagPrefix="uc1" TagName="Title" Src="Components/Title.ascx" %> and how do i use the control in my template page?
1
1061
by: Rahul Agarwal | last post by:
Hi We got a Page template which has a standard list of javascript and stylesheet inclusions but when its inherited in other pages, we want to include the javascripts related with that page. What's the best way of doing this? Please advice, thanks Rahul
1
945
by: Beegee | last post by:
Dear all, I am new to ASP.NET and looking around for the Page Template methods given in the internet (using user controls). Please suggest me the one which is easy to maintain. Thanks
0
1089
by: JT | last post by:
I have created master pages in the past but it was a while ago. Today I installed the Atlas download (July 2006 version). I went to create a website project and went to the Solution Explorer, highlighted my project, right-clicked and clicked on Add New Item... Under Visual Studio installed templates, I expected to see a Master Page template but it is no longer there. I uninstalled Atlas and the Master Page template is still not there. ...
3
1298
by: UFG | last post by:
Okay so I'm sure this has been gone over before, but I tried searching and I couldn't find anything about it probably because I have no idea what this is really called. Basically, I want to have a web page template, say "gallery.php". And I have an image, say "canyon.jpg". What I want to happen is I want to be able to put "http://blahblah.com/gallery.php?=canyon" in my address bar and when i go to that website it has the gallery.php...
2
2612
by: aitrob | last post by:
Hi, I have a problem concerning templates/inheritance. I have a code that compiles fine with g++ 4.0.1 (Apple version), but gives a lot of errors with Intel C++ 10.1 (Mac OS X). I'm not sure if I'm doing something wrong and g++ just doesn't notice, or if the people at Intel are doing something weird... What am I trying to do? I'm trying to implement a template class that inherits from the Blitz++ array library #include <blitz/array.h>...
0
10151
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11556
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11150
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10685
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8245
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6111
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4933
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.