Solved

I'm having difficulty understanding page inheritance

Posted on 2008-06-21
8
616 Views
Last Modified: 2013-11-07
Hello all

In an effort to enhance my skillbase I am trying to get to grips with Visual Basic (and C#) ASP .NET programming. All is going well except for this error regarding page inheritance. It has cropped up a few times and I though I'd cracked it with an earlier success, but here it comes again.

I have defined my namespaces (ACS.console) in my app_code/basepage.vb file and imported it appropriately into my master page code behind file. I have defined the master page namespace and the class, and referred to the class correctly in the master page header.

Yet still I have this error. I admit to being a noob at VB.NET so I'm hoping for some sympathetic expert to be gentle with me. :)

Thanks in advance, and here is the code...

~/app_code/basepage.vb
----------------------
 
 
imports system
imports system.web
imports system.web.ui
 
namespace ACS.console
 
	public class basepage
	
		inherits page
		
		...
 
	end class
	
end namespace
 
 
 
 
~/console/console.master
------------------------
 
 
<%@ Master Language="VB" CodeFile="console.master.vb" Inherits="ACS.console.master.mastercode" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
etc. etc.
 
 
 
 
~/console/console.master.vb
---------------------------
 
 
Imports System
Imports System.Xml
Imports System.Web
Imports System.Web.UI
Imports ACS.console
 
 
 
 
 
 
namespace ACS.console.master
 
	public class mastercode
		inherits page
		
		public sub page_load
 
...

Open in new window

0
Comment
Question by:jerute
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 18

Accepted Solution

by:
Richard Lee earned 500 total points
ID: 21837697
Your question is not entirely clear. What exactly is the error?

One thing I have spotted however is that your master page class is inheriting the Page class; it should inherit the MasterPage class.
0
 

Author Comment

by:jerute
ID: 21837745
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
0
 
LVL 5

Expert Comment

by:JuckMan
ID: 21839652
you need a code behind file only if your want to have server side handling.

If u really want to understand how this works review the article on this link.
http://msdn.microsoft.com/en-us/library/ms178472.aspx

Also note you can sperately create a page class and hook up with any aspx page. In this way you can create a single page class and should be able to use it as a code behind for any aspx page provided you define it in your aspx page and your code behind class..

0
Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

 

Author Comment

by:jerute
ID: 21840332
I have got a code behind file (console.master.vb) but co-incidentally I have discovered the solution myself.

Instead of inheriting System.Web.UI.Page it needs to inherit System.Web.UI.Masterpage.
0
 
LVL 18

Expert Comment

by:Richard Lee
ID: 21842376
The solution was posted in Comment: ID:21837697
0
 
LVL 18

Expert Comment

by:Richard Lee
ID: 21843838
The solution was posted in Comment: ID:21837697
0
 

Author Comment

by:jerute
ID: 21843927
Sorry Da Tribe. Didn't read you comment fully. You get the points fairly.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question