473,657 Members | 2,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

object reference not set to an instance of an object

Hi,

Very new to asp.net. Using VStudio 2005 on an XP Pro machine. Using Cassini
to view.

I see this error discussed all over the net but don't seem to find a way to
resolve my particular grief -- which I am sure is not unique. Here are my
basic steps:

1) create a masterpage -- add some simple graphics to the header.
2) add a new web form that references the master page and attaches a code
behind file. (actually added 3 files referencing the same mpage -- each
errors)
3) add some basic html into the placeholder auto-created in the web form
page, ie:

<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">

</asp:Content>
4) view the page and it all views okay.

But when I look at the page in design mode -- the Content placeholder shows
this error -- and it is referenced in the error list as well.

=============== =
Error creating control - Content1
object reference not set to an instance of an object
=============== =

Can anyone give me a heads up as to what this error means, how to get rid of
it, etc. I am guessing that it wants me to declare an object -- but where
(assuming codebehind file) and I am wondering why vstudio doesn't auto do
it? - which makes me think my guess is wrong.

thanks

Dec 28 '06 #1
7 13924
save your project , close out and reopen, that usually clears that problem up for me.
"thersitz" <th******@gmail .comwrote in message news:uS******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

Very new to asp.net. Using VStudio 2005 on an XP Pro machine. Using Cassini to view.

I see this error discussed all over the net but don't seem to find a way to resolve my particular grief -- which I am sure is not
unique. Here are my basic steps:

1) create a masterpage -- add some simple graphics to the header.
2) add a new web form that references the master page and attaches a code behind file. (actually added 3 files referencing the
same mpage -- each errors)
3) add some basic html into the placeholder auto-created in the web form page, ie:

<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1" Runat="Server">

</asp:Content>
4) view the page and it all views okay.

But when I look at the page in design mode -- the Content placeholder shows this error -- and it is referenced in the error list
as well.

=============== =
Error creating control - Content1
object reference not set to an instance of an object
=============== =

Can anyone give me a heads up as to what this error means, how to get rid of it, etc. I am guessing that it wants me to declare an
object -- but where (assuming codebehind file) and I am wondering why vstudio doesn't auto do it? - which makes me think my guess
is wrong.

thanks

Dec 28 '06 #2
Thanks Jon. I saw that suggestion in one of my google returns and tried
it -- but to no avail.

I've been playing around a bit and have noticed that this error does not
show until I paste in some basic html. I am going slowly into this aspNet
thing and am still using some traditional html -- div, p, table -- as i get
a feel for vstudio etc -- not using the html controls.

So my html is producing the error -- but why?
"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot comwrote in message
news:OU******** *****@TK2MSFTNG P04.phx.gbl...
save your project , close out and reopen, that usually clears that problem
up for me.
"thersitz" <th******@gmail .comwrote in message
news:uS******** ******@TK2MSFTN GP03.phx.gbl...
>Hi,

Very new to asp.net. Using VStudio 2005 on an XP Pro machine. Using
Cassini to view.

I see this error discussed all over the net but don't seem to find a way
to resolve my particular grief -- which I am sure is not unique. Here are
my basic steps:

1) create a masterpage -- add some simple graphics to the header.
2) add a new web form that references the master page and attaches a code
behind file. (actually added 3 files referencing the same mpage -- each
errors)
3) add some basic html into the placeholder auto-created in the web form
page, ie:

<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server" >

</asp:Content>
4) view the page and it all views okay.

But when I look at the page in design mode -- the Content placeholder
shows this error -- and it is referenced in the error list as well.

============== ==
Error creating control - Content1
object reference not set to an instance of an object
============== ==

Can anyone give me a heads up as to what this error means, how to get rid
of it, etc. I am guessing that it wants me to declare an object -- but
where (assuming codebehind file) and I am wondering why vstudio doesn't
auto do it? - which makes me think my guess is wrong.

thanks


Dec 28 '06 #3
Well I have narrowed the source of the error to this piece of code:

<!--#include file="imageBar. inc" -->

So I just need to come up with an aspnet version of this code.

thanks


"thersitz" <th******@gmail .comwrote in message
news:uS******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

Very new to asp.net. Using VStudio 2005 on an XP Pro machine. Using
Cassini to view.

I see this error discussed all over the net but don't seem to find a way
to resolve my particular grief -- which I am sure is not unique. Here are
my basic steps:

1) create a masterpage -- add some simple graphics to the header.
2) add a new web form that references the master page and attaches a code
behind file. (actually added 3 files referencing the same mpage -- each
errors)
3) add some basic html into the placeholder auto-created in the web form
page, ie:

<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">

</asp:Content>
4) view the page and it all views okay.

But when I look at the page in design mode -- the Content placeholder
shows this error -- and it is referenced in the error list as well.

=============== =
Error creating control - Content1
object reference not set to an instance of an object
=============== =

Can anyone give me a heads up as to what this error means, how to get rid
of it, etc. I am guessing that it wants me to declare an object -- but
where (assuming codebehind file) and I am wondering why vstudio doesn't
auto do it? - which makes me think my guess is wrong.

thanks

Dec 28 '06 #4
Try just running that piece of code by itself (copy it to a blank web page)
It sounds like something in particular on that page might be causing the
problem.
--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com

"thersitz" <th******@gmail .comwrote in message
news:uy******** ******@TK2MSFTN GP03.phx.gbl...
Well I have narrowed the source of the error to this piece of code:

<!--#include file="imageBar. inc" -->

So I just need to come up with an aspnet version of this code.

thanks


"thersitz" <th******@gmail .comwrote in message
news:uS******** ******@TK2MSFTN GP03.phx.gbl...
>Hi,

Very new to asp.net. Using VStudio 2005 on an XP Pro machine. Using
Cassini to view.

I see this error discussed all over the net but don't seem to find a way
to resolve my particular grief -- which I am sure is not unique. Here are
my basic steps:

1) create a masterpage -- add some simple graphics to the header.
2) add a new web form that references the master page and attaches a code
behind file. (actually added 3 files referencing the same mpage -- each
errors)
3) add some basic html into the placeholder auto-created in the web form
page, ie:

<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server" >

</asp:Content>
4) view the page and it all views okay.

But when I look at the page in design mode -- the Content placeholder
shows this error -- and it is referenced in the error list as well.

============== ==
Error creating control - Content1
object reference not set to an instance of an object
============== ==

Can anyone give me a heads up as to what this error means, how to get rid
of it, etc. I am guessing that it wants me to declare an object -- but
where (assuming codebehind file) and I am wondering why vstudio doesn't
auto do it? - which makes me think my guess is wrong.

thanks


Dec 29 '06 #5
Try just running that piece of code by itself (copy it to a blank web page)
It sounds like something in particular on that page might be causing the
problem.
--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com

"thersitz" <th******@gmail .comwrote in message
news:uy******** ******@TK2MSFTN GP03.phx.gbl...
Well I have narrowed the source of the error to this piece of code:

<!--#include file="imageBar. inc" -->

So I just need to come up with an aspnet version of this code.

thanks


"thersitz" <th******@gmail .comwrote in message
news:uS******** ******@TK2MSFTN GP03.phx.gbl...
>Hi,

Very new to asp.net. Using VStudio 2005 on an XP Pro machine. Using
Cassini to view.

I see this error discussed all over the net but don't seem to find a way
to resolve my particular grief -- which I am sure is not unique. Here are
my basic steps:

1) create a masterpage -- add some simple graphics to the header.
2) add a new web form that references the master page and attaches a code
behind file. (actually added 3 files referencing the same mpage -- each
errors)
3) add some basic html into the placeholder auto-created in the web form
page, ie:

<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server" >

</asp:Content>
4) view the page and it all views okay.

But when I look at the page in design mode -- the Content placeholder
shows this error -- and it is referenced in the error list as well.

============== ==
Error creating control - Content1
object reference not set to an instance of an object
============== ==

Can anyone give me a heads up as to what this error means, how to get rid
of it, etc. I am guessing that it wants me to declare an object -- but
where (assuming codebehind file) and I am wondering why vstudio doesn't
auto do it? - which makes me think my guess is wrong.

thanks



Dec 29 '06 #6
Tom
I am having the same issue. I have a master page with one editable region. When I use the master and place plain html 4.0 data in the editable region it creates this error while in design view. Error Creating Control - Content1 Object Reference not set to an instance of an object.

The page renders correctly and build correctly. I have restart and tried various data. Is it becuase I am creating the page in another folder other than the master page. Even though it is looking for web root is it confused?

The page directive looks like this:

<%@ Page Language="C#" MasterPageFile= "~/public/Public.master" >>The rest is normal stuff.

My Directory structure is:

/
/public
/public/info
/public/news
/public/...more folders

my master is in /public/Public.master

The pages I am having issues in are the subfolders

/public/info/page_one.aspx

The files in the same folder as the master works fine:
/public/public.Master
/public/Default.aspx

Thanks

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Jan 22 '07 #7
you may find the answer here.

http://odetocode.com/Articles/450.aspx

Mike

On Jan 21, 9:20 pm, Tom wrote:
I am having the same issue. I have amasterpagewith one editable region. When I use themasterand place plain html 4.0 data in the editable region it creates this error while in design view. Error Creating Control - Content1ObjectR eferencenotsett o aninstanceof anobject.

Thepagerenders correctly and build correctly. I have restart and tried various data. Is it becuase I am creating thepagein another folder other than themasterpage. Even though it is looking for web root is it confused?

Thepagedirectiv e looks like this:

<%@PageLanguage ="C#" MasterPageFile= "~/public/Public.master" >>The rest is normal stuff.

My Directory structure is:

/
/public
/public/info
/public/news
/public/...more folders

mymasteris in /public/Public.master

The pages I am having issues in are the subfolders

/public/info/page_one.aspx

The files in the same folder as themasterworks fine:
/public/public.Master
/public/Default.aspx

Thanks

EggHeadCafe.com - .NET Developer Portal of Choicehttp://www.eggheadcafe .com
Jan 27 '07 #8

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

Similar topics

2
10540
by: Pkpatel | last post by:
Hi, I keep getting this error every time I try to load crystalreportviewer on a webform with a dataset. Here is the error: -------------------------------------------------------- Server Error in '/Cr_Dataset' Application. ----------------------------------------------------------- ---------------------
6
7143
by: NewToDotNet | last post by:
I am getting "Object reference not set to an instance of an object. " when I attempt to open a C# windows service class in design view, although I was able to initially create the service and open in design view. This happens once I restarted Visual Studio adn opened teh solution Any ideas on how to fix this would be appreciated.. BR ::Ben
4
2678
by: Frawls | last post by:
Hi, I get the following error when trying to run a search on my aspx site, this error only occours if the product im searching for does not exist. Can anybody explain this please and help me with a solution, i know its probably simple but im new to the game...Cheers ----------------------------------------------------------------------- Object reference not set to an instance of an object.
2
1763
by: jw56578 | last post by:
why am i getting the "Object reference not set to an instance of an object" error on all page registeration tags in my project. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="bid_history.aspx.vb" Inherits="dnfExchange.marketing_bid_history" %>
3
455
by: nemo | last post by:
Hi, My application works fine on the localhost but spits this error as soon as I put it on the server. I know this error occurs when an object has not been instantiated prior to a reference, but why shouldn't it happen in the localhost? Here's what the the whole error msg looks like:
3
4211
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page that needs the class module I get an error on web site: Object reference not set to an instance of an object Here is where the error is:
7
1564
by: Brett | last post by:
I'm not sure why I keep getting this error, "Object reference not set to an instance of an object". Private Function somefunction() as string Dim MyCurrentClass As New Class1 Try For i As Integer = 0 To LinkResults.Length - 1 With MyCurrentClass.SqlCmd_Insert_LinkVB .CommandType = System.Data.CommandType.StoredProcedure
6
2214
by: kalaivanan | last post by:
hi, i am a beginner in c#. i have theoretical knowledge about object, reference and instance. but i want to know clearly about what is an object, reference and instance. can any one help me? or is there any article which can explain it. kalaivanan
1
2741
by: vishnu | last post by:
Hi, I am working on asp.net project which I converted the code fron VB to C# and instead of RaiseEvent in VB code I used the following code. using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security;
4
2177
by: livmacca | last post by:
Hi, I am new to VB .Net programming and is trying to create a webpage. I encountered the following error and is totally clueless on how to make it work: ==================ERROR================================== Object reference not set to an instance of an object. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
0
8395
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
8310
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
8826
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
8732
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...
1
6166
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
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4155
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...
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.