Last post Apr 16, 2008 01:48 AM by SajidWahab
Mar 13, 2008 03:24 PM|quantass0|LINK
Im using MS Visual Studio .NET 2003 and .NET v1.1 Framework under C#. I've created a new class, MyNewPage, which inherits the System.Web.UI.Page class. I've created a new Web App project and renamed the default base class Page to my new class MyNewPage.
ALl is fine and compiles well but when i go to the design view i get the error message:
File could not be loaded into the Web Forms Designer.
An exception occurred while trying to create an instance of MyNewPage. The exception was "Object reference not set to an instance of an object.".
Make sure all of the classed used in the page are built or referenced in the project
Any ideas on how to resolve this error message. Again all still works but i hate to see error dialogs.
Mar 14, 2008 08:59 AM|suzye|LINK
I'm having the exact same problem! I have another solution on my PC that someone else wrote and it does the same thing but the designer DOES open. I don't see any differences. I will have to throw out the idea of using inheritance totally because of this.
I cannot use the designer so I cannot drag and drop controls.
Apr 16, 2008 01:48 AM|SajidWahab|LINK
well this is interesting problem,, that's why people upgrade to 2005 and onward.. :)
2 points to be noted:
1. check whether or not this is difference b/w the NAMESPACES of these 2 classes having the same name. (well you might have checked it as it will throw error of Class abc already exists in namespace A)
2. check whether in the HTML view of abc.aspx -> Page TAG -> inherits: see if there is the same name that you have specified for the class,,,
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Namespace1.WebForm1" %>
if not then modify it,, rebuild it and see the problem will be solved...if not then ,,,
after renaming it goto abc.aspx.cs and retype the class name and this time you will see the name is automatically reflected in
abc.aspx HTML view
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Namespace1.abc" %>
this surely have solved the problem,, as I have tested it...[:P]
(: Please mark it as answar,, if it helped in solving your problem :)