473,554 Members | 3,079 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 13920
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
10530
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
7140
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...
4
2674
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 ----------------------------------------------------------------------- ...
2
1760
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
4203
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
1562
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
2211
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
2738
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
2173
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...
0
7594
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...
0
7519
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...
0
7885
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...
0
6137
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...
0
5151
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...
0
3544
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2014
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
1125
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
835
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...

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.