Connecting Tech Pros Worldwide Help | Site Map

object reference not set to an instance of an object

 
LinkBack Thread Tools Search this Thread
  #1  
Old December 28th, 2006, 06:45 PM
thersitz
Guest
 
Posts: n/a
Default 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" ContentPlaceHolderID="ContentPlaceHolder1"
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




  #2  
Old December 28th, 2006, 06:55 PM
Jon Paal
Guest
 
Posts: n/a
Default Re: object reference not set to an instance of an object

save your project , close out and reopen, that usually clears that problem up for me.


"thersitz" <thersitz@gmail.comwrote in message news:uSQH0crKHHA.1240@TK2MSFTNGP03.phx.gbl...
Quote:
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" ContentPlaceHolderID="ContentPlaceHolder1" 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
>
>
>

  #3  
Old December 28th, 2006, 07:15 PM
thersitz
Guest
 
Posts: n/a
Default Re: object reference not set to an instance of an object

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:OUl5vjrKHHA.448@TK2MSFTNGP04.phx.gbl...
Quote:
save your project , close out and reopen, that usually clears that problem
up for me.
>
>
"thersitz" <thersitz@gmail.comwrote in message
news:uSQH0crKHHA.1240@TK2MSFTNGP03.phx.gbl...
Quote:
>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" ContentPlaceHolderID="ContentPlaceHolder1"
>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
>>
>>
>>
>
>

  #4  
Old December 28th, 2006, 08:06 PM
thersitz
Guest
 
Posts: n/a
Default Re: object reference not set to an instance of an object

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" <thersitz@gmail.comwrote in message
news:uSQH0crKHHA.1240@TK2MSFTNGP03.phx.gbl...
Quote:
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" ContentPlaceHolderID="ContentPlaceHolder1"
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
>
>
>

  #5  
Old December 29th, 2006, 03:15 AM
David Wier
Guest
 
Posts: n/a
Default Re: object reference not set to an instance of an object

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" <thersitz@gmail.comwrote in message
news:uybzSKsKHHA.4460@TK2MSFTNGP03.phx.gbl...
Quote:
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" <thersitz@gmail.comwrote in message
news:uSQH0crKHHA.1240@TK2MSFTNGP03.phx.gbl...
Quote:
>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" ContentPlaceHolderID="ContentPlaceHolder1"
>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
>>
>>
>>
>
>



  #6  
Old December 29th, 2006, 03:15 AM
David Wier
Guest
 
Posts: n/a
Default Re: object reference not set to an instance of an object

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" <thersitz@gmail.comwrote in message
news:uybzSKsKHHA.4460@TK2MSFTNGP03.phx.gbl...
Quote:
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" <thersitz@gmail.comwrote in message
news:uSQH0crKHHA.1240@TK2MSFTNGP03.phx.gbl...
Quote:
>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" ContentPlaceHolderID="ContentPlaceHolder1"
>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
>>
>>
>>
>
>




  #7  
Old January 22nd, 2007, 01:25 AM
Tom
Guest
 
Posts: n/a
Default Re: object reference not set to an instance of an object

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
  #8  
Old January 27th, 2007, 02:25 PM
mike@5starserv.com
Guest
 
Posts: n/a
Default Re: object reference not set to an instance of an object

you may find the answer here.

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

Mike

On Jan 21, 9:20 pm, Tom wrote:
Quote:
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 - Content1ObjectReferencenotsetto 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?
>
Thepagedirective 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.