473,626 Members | 3,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subclassing from System.Web.UI.P age - Designer Error

We have need to share functionality across all of our application web pages, so we decided to subclass from System.Web.UI.P age. When we create a new aspx, the Visual Studio designer automatically puts in the codebehind, as such:

public class testsubclass : System.Web.UI.P age

We change this to be:

public class testsubclass : OurProject.Libr ary.BaseWebPage

Which is defined as:

public class OurProject.Libr ary.BaseWebPage : System.Web.UI.P age

The application will compile and run and all inheritance operates as expected. However, the designer stops working with the aspx file.

If you have the aspx file closed and open it, you get only an editor for the raw HTML, the designer will not open and the error:

An exception occurred while trying to create an instance of OurProject.Libr ary.BaseWebPage . The exception was "Object reference not set to an instance of an object."

It also says: make sure all of the classes used in the page are built or referenced in the project.

I've tried opening it with the Library project which contains BaseWebPage included in the solution, and I've tried it with the Library project being compiled and the resulting DLL referenced. (Debug compile only...)

If you revert the testpage back to System.Web.UI.P age and close and reopen the aspx file, the designer works properly. If you have the designer open and then change it back to the subclass type derived from Page, the error occurs and while the designer stays open, the toolbox controls stop working and the designer is rendered useless.

Any advice would be most apprciated!
Nov 18 '05 #1
1 2577
Have you tried this with VS.net 2003? I had problems inheriting a
code-behind from a superclass in VS.net 2002, but they all disappeared
when I upgraded.

-Mike

On Fri, 20 Feb 2004 06:06:05 -0800, "Chuck Haeberle"
<an*******@disc ussions.microso ft.com> wrote:
We have need to share functionality across all of our application web pages, so we decided to subclass from System.Web.UI.P age. When we create a new aspx, the Visual Studio designer automatically puts in the codebehind, as such:

public class testsubclass : System.Web.UI.P age
We change this to be:

public class testsubclass : OurProject.Libr ary.BaseWebPage

Which is defined as:

public class OurProject.Libr ary.BaseWebPage : System.Web.UI.P age

The application will compile and run and all inheritance operates as expected. However, the designer stops working with the aspx file.

If you have the aspx file closed and open it, you get only an editor for the raw HTML, the designer will not open and the error:

An exception occurred while trying to create an instance of OurProject.Libr ary.BaseWebPage . The exception was "Object reference not set to an instance of an object."

It also says: make sure all of the classes used in the page are built or referenced in the project.

I've tried opening it with the Library project which contains BaseWebPage included in the solution, and I've tried it with the Library project being compiled and the resulting DLL referenced. (Debug compile only...)

If you revert the testpage back to System.Web.UI.P age and close and reopen the aspx file, the designer works properly. If you have the designer open and then change it back to the subclass type derived from Page, the error occurs and while the designer stays open, the toolbox controls stop working and the designer is rendered useless.

Any advice would be most apprciated!


Nov 18 '05 #2

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

Similar topics

11
3467
by: Brent | last post by:
I'd like to subclass the built-in str type. For example: -- class MyString(str): def __init__(self, txt, data): super(MyString,self).__init__(txt) self.data = data
0
9769
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520" AutoPostBackOnNodeMove="false" DragAndDropEnabled="true" NodeEditingEnabled="False" KeyboardEnabled="true" CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode" HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit"
17
9682
by: Rodusa | last post by:
I am getting this exception error which is driving me nuts. System.NullReferenceException - Object reference not set to an instance of an object If I comment this line, I don't get any errors: string Total_Dollar_Amount = GetTotal(sql,"test"); namespace SalesReport
1
3391
by: S Guiboud | last post by:
I want to subclass the System.Web.UI.UserControl to make a common control for my site. Then, when I create a new UserControl from the Visual Studio I changed the base class System.Web.UI.UserControl to my UserControl class (a.k.a MyUserControl). MyUserControl is only a .cs file with a class inheriting from System.Web.UI.UserControl. But, when I try to view the control in the Visual Studio designer it always pop me a window asking me if I...
3
4142
by: Patrick.O.Ige | last post by:
I'm loading an Array below but getting the error "Object reference not set to an instance saying 'ItemNumber = CType(Args.Item.FindControl("ItemNumber"), TextBox).Text' is the error line. I DON'T KNOW WHAT I'M DOING WRONG I USED ASP.NETWebMatrix and its working well!! Any help!! I have declared ItemNumber as u can see below " :-
3
8822
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I don't think I made any changes to either page other than changing the user control that creates the header). Server Error in '/myApp' Application. ---------------------------------------------------------------------------- ----
2
3488
by: Ryan | last post by:
Hi, I receive an access denied error (see below) when attempting to send an email with BodyFormat=MailFormat.Html from an asp.net page. Exactly the same code works fine in a console application, and also succeeds from the asp.net page with BodyFormat=MailFormat.Text. I've recently upgraded from W2K SP4 to WinXP SP2 and am using .Net Framework v1.1 SP1. The code worked fine under W2K SP4.
3
4003
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user selects? thanks...
1
4754
by: differentsri | last post by:
THIS IS AN ASP.NET 1.1 APPLICATION IAM TRYING TO UPDATE THE FIELD BUT I AM NOT ABLE TO UPDATE IT? CAN U TELL THE REASON ? IT IS GIVING THE FOLLOWING ERROR BELOW I HAVE ALSO GIVEN THE CODE OF THE PROGRAM PLEASE HELP ME Server Error in '/WebApplication1' Application. -------------------------------------------------------------------------------- Input string was not in a correct format. Description: An unhandled exception occurred...
0
8269
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
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8642
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
8512
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...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
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
4094
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...
1
2630
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
1
1815
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.