473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

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

Dec 28 '06 #1
7 13915
save your project , close out and reopen, that usually clears that problem up for me.
"thersitz" <th******@gmail.comwrote in message news:uS**************@TK2MSFTNGP03.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" 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

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*************@TK2MSFTNGP04.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**************@TK2MSFTNGP03.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" 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


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**************@TK2MSFTNGP03.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" 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

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**************@TK2MSFTNGP03.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**************@TK2MSFTNGP03.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" 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


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**************@TK2MSFTNGP03.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**************@TK2MSFTNGP03.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" 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



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 - 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
Jan 27 '07 #8

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

Similar topics

2
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...
6
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...
4
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...
2
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"...
3
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...
3
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...
7
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...
6
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...
1
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...
4
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: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.