473,386 Members | 1,758 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,386 software developers and data experts.

Visual Studio .NET 2005 reports false error

I'm using Visual Studio .NET 2005 with a C# Web Application project. I
have an ASPX page that uses a MasterPage file for a general site
layout. That works just fine, but when I run a compile of the ASPX
page (say default.aspx) with something like:

<asp:Label id="lblFoo" runat="server" />

and have it's codebehind have:

protected void Page_Load(object sender, EventArgs e)
{
this.txtFoo.Text = "this works";
}

However, when I run a compile, the Error List reports that:
'Default' does not contain a definition for 'txtFoo'

when clearly there is. The problem is that the project compiles and
runs fine, but the error list is reporting an incorrect error. Does
anyone else have a similar problem with VS.NET 2005? Is this a bug in
the IDE?

Some added notes:
- I do have multiple Default.aspx across my project, but they are in
different folders and I have checked that all referencing paths are
correct.
- I did copy & paste some code from a different page into this ASPX
page, and started noticing this bug, but I have commented out such code
and still get this problem running the above example. Is there a bug
with copying & pasting code from another ASPX page that runs something
similar to what I have above?

Thanks so much

Dec 4 '06 #1
4 1066
try

lblFoo.Text = "this works";

txtFoo does not exist in your project.
tofu.captain wrote:
I'm using Visual Studio .NET 2005 with a C# Web Application project. I
have an ASPX page that uses a MasterPage file for a general site
layout. That works just fine, but when I run a compile of the ASPX
page (say default.aspx) with something like:

<asp:Label id="lblFoo" runat="server" />

and have it's codebehind have:

protected void Page_Load(object sender, EventArgs e)
{
this.txtFoo.Text = "this works";
}

However, when I run a compile, the Error List reports that:
'Default' does not contain a definition for 'txtFoo'

when clearly there is. The problem is that the project compiles and
runs fine, but the error list is reporting an incorrect error. Does
anyone else have a similar problem with VS.NET 2005? Is this a bug in
the IDE?

Some added notes:
- I do have multiple Default.aspx across my project, but they are in
different folders and I have checked that all referencing paths are
correct.
- I did copy & paste some code from a different page into this ASPX
page, and started noticing this bug, but I have commented out such code
and still get this problem running the above example. Is there a bug
with copying & pasting code from another ASPX page that runs something
similar to what I have above?

Thanks so much
Dec 4 '06 #2
oops, actually what i have is that, i just wrong my example in this
topic wrong. but the issue still stands.

so what i have is:
<asp:TextBox id="txtFoo" runat="server" />

codebehind:
protected void Page_Load(object sender, EventArgs e)
{
this.txtFoo.Text = "this works";
}

sorry for the misprint.

Chicagoboy27 wrote:
try

lblFoo.Text = "this works";

txtFoo does not exist in your project.
tofu.captain wrote:
I'm using Visual Studio .NET 2005 with a C# Web Application project. I
have an ASPX page that uses a MasterPage file for a general site
layout. That works just fine, but when I run a compile of the ASPX
page (say default.aspx) with something like:

<asp:Label id="lblFoo" runat="server" />

and have it's codebehind have:

protected void Page_Load(object sender, EventArgs e)
{
this.txtFoo.Text = "this works";
}

However, when I run a compile, the Error List reports that:
'Default' does not contain a definition for 'txtFoo'

when clearly there is. The problem is that the project compiles and
runs fine, but the error list is reporting an incorrect error. Does
anyone else have a similar problem with VS.NET 2005? Is this a bug in
the IDE?

Some added notes:
- I do have multiple Default.aspx across my project, but they are in
different folders and I have checked that all referencing paths are
correct.
- I did copy & paste some code from a different page into this ASPX
page, and started noticing this bug, but I have commented out such code
and still get this problem running the above example. Is there a bug
with copying & pasting code from another ASPX page that runs something
similar to what I have above?

Thanks so much
Dec 4 '06 #3
I think the issue here is that VS 2005 has the concept of partial classes.
The designer class that's "supposed" to have the declarations of your page's
controls isn't getting one, e.g. "protected Label lblFoo;"
You can either supply one yourself by typing it in, or sometimes if you
switch from design to code view and then back again, it gets itself "back
together".
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"tofu.captain" wrote:
oops, actually what i have is that, i just wrong my example in this
topic wrong. but the issue still stands.

so what i have is:
<asp:TextBox id="txtFoo" runat="server" />

codebehind:
protected void Page_Load(object sender, EventArgs e)
{
this.txtFoo.Text = "this works";
}

sorry for the misprint.

Chicagoboy27 wrote:
try

lblFoo.Text = "this works";

txtFoo does not exist in your project.
tofu.captain wrote:
I'm using Visual Studio .NET 2005 with a C# Web Application project. I
have an ASPX page that uses a MasterPage file for a general site
layout. That works just fine, but when I run a compile of the ASPX
page (say default.aspx) with something like:
>
<asp:Label id="lblFoo" runat="server" />
>
and have it's codebehind have:
>
protected void Page_Load(object sender, EventArgs e)
{
this.txtFoo.Text = "this works";
}
>
However, when I run a compile, the Error List reports that:
'Default' does not contain a definition for 'txtFoo'
>
when clearly there is. The problem is that the project compiles and
runs fine, but the error list is reporting an incorrect error. Does
anyone else have a similar problem with VS.NET 2005? Is this a bug in
the IDE?
>
Some added notes:
- I do have multiple Default.aspx across my project, but they are in
different folders and I have checked that all referencing paths are
correct.
- I did copy & paste some code from a different page into this ASPX
page, and started noticing this bug, but I have commented out such code
and still get this problem running the above example. Is there a bug
with copying & pasting code from another ASPX page that runs something
similar to what I have above?
>
Thanks so much

Dec 4 '06 #4
i actually did that and i get an error that the control is already
declared. which, doesn't make sense...

Peter wrote:
I think the issue here is that VS 2005 has the concept of partial classes.
The designer class that's "supposed" to have the declarations of your page's
controls isn't getting one, e.g. "protected Label lblFoo;"
You can either supply one yourself by typing it in, or sometimes if you
switch from design to code view and then back again, it gets itself "back
together".
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"tofu.captain" wrote:
oops, actually what i have is that, i just wrong my example in this
topic wrong. but the issue still stands.

so what i have is:
<asp:TextBox id="txtFoo" runat="server" />

codebehind:
protected void Page_Load(object sender, EventArgs e)
{
this.txtFoo.Text = "this works";
}

sorry for the misprint.

Chicagoboy27 wrote:
try
>
lblFoo.Text = "this works";
>
txtFoo does not exist in your project.
>
>
tofu.captain wrote:
I'm using Visual Studio .NET 2005 with a C# Web Application project. I
have an ASPX page that uses a MasterPage file for a general site
layout. That works just fine, but when I run a compile of the ASPX
page (say default.aspx) with something like:

<asp:Label id="lblFoo" runat="server" />

and have it's codebehind have:

protected void Page_Load(object sender, EventArgs e)
{
this.txtFoo.Text = "this works";
}

However, when I run a compile, the Error List reports that:
'Default' does not contain a definition for 'txtFoo'

when clearly there is. The problem is that the project compiles and
runs fine, but the error list is reporting an incorrect error. Does
anyone else have a similar problem with VS.NET 2005? Is this a bug in
the IDE?

Some added notes:
- I do have multiple Default.aspx across my project, but they are in
different folders and I have checked that all referencing paths are
correct.
- I did copy & paste some code from a different page into this ASPX
page, and started noticing this bug, but I have commented out such code
and still get this problem running the above example. Is there a bug
with copying & pasting code from another ASPX page that runs something
similar to what I have above?

Thanks so much
Dec 5 '06 #5

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

Similar topics

2
by: Wendy Elizabeth | last post by:
I was just assigned a project at work to setup a CRM web system. However from what I have heard Visual Studio 2005 Team System is suppose to be a CRM system. Is it a metholodologythat Microsoft...
4
by: Charts | last post by:
6/23/05 ..NET Development\Framework\dotnet.framework.aspnet Visual Studio 2005 Beta 2 project cannot work in IIS virtual directory I used Visual Studio 2005 Beta 2 to build a simple new...
1
by: Kannan | last post by:
Hi, I have noticed that Visual studio 2005 coming along with Crystal report. I have few crystal reports which is developed in 6.0 in my existing VB project and currently we are migrating m y VB...
6
by: phnimx | last post by:
I'm attempting to migrate a predominately MFC application that I've just inherited from Visual Studio.NET 2003 to Visual Studio 2005. I've managed to clean up a myriad of compile and link errors...
8
by: WT | last post by:
Is it normal that Visual Studio sets the PreInit handler for a Page from the OnInit code ? No chance to fire it as OnPreInit is run befor OnInit. ??? CS
3
by: Edwin Smith | last post by:
I have a 2 form project in VS2005 that now hangs whenever I try to do anything with the second form. This seems to have started when I added some SQL tables from a Pervasive v.9 database using the...
0
by: =?Utf-8?B?S2FybCBQb3RoYXN0?= | last post by:
According to this page Crystal Reports for Visual Studio 2005 Service Pack 1 should be released soon. Does anyone know the exact release date for this? ...
1
by: bharathreddy | last post by:
This Article gives an introduction to VSTS Team Foundation & fundamental difference between Visual Source Safe (VSS) and VSTS Team Foundation. Team Foundation is a set of tools and technologies...
1
by: =?Utf-8?B?Y2hhaXJtYW4=?= | last post by:
I am trying to set up a Report Server to publish reports that I have created in Visual Studio 2005. I have been able to get it up and running and I am able to access reports via the web and set up...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.