CS0103 - strange errors

E

Eric

I get following errors under C#
The name 'txtName' does not exist in the current context
The name 'txtName' does not exist in the current context

This is a nightmare. I have my web user control and I
dragged it into DIV on my .aspx page. It's just a panel with a few textboxes.
When I try to access some textbox, the above errors show up.
What is the remedy - I want to reuse this control on different pages.
Using VB.NET all works fine but I have to use C#.
I beg for help.

Eric
 
?

=?ISO-8859-2?Q?G=F6ran_Andersson?=

The most obvious difference between VB and C# when it comes to
identifying names is that C# is case sensetive, while VB is not.

Is the id of the control really "txtName", not some other case variation
like "txtname" or "TxtName"?
 
E

Eric

Göran Andersson said:
The most obvious difference between VB and C# when it comes to identifying names is that C# is case sensetive, while VB is not.

Is the id of the control really "txtName", not some other case variation like "txtname" or "TxtName"?


No. I checked and it's exactly the name that pops out after dot automaticaly.
FindControl() finds the "textName" but WHY on earth it doesn't allow
a simple access?? I created a new user control and the same thing happened.
Please help.

Eric
 
G

Guest

I have this same thing happening, but it happens in some files and not
others. I'm using Win2K (fully patched), .NET 2.0, and VS.NET 2005.

I have a series of files to maintain code table pages. All of them are
clones of a basic template (no comments on architecture, please). Most of
them are fine, one is not. When I do a Build Page, it's fine, but whenever I
Build or Rebuild the site or solution I get CS0103 errors ("The name
'CtrlSqlErrorDisplay1' does not exist in the curent contect.") in the .cs
file where I'm referencing the control on the aspx page. If I copy the files
to the site the problematic page runs fine, so I guess this is more ticking
me off than causing a problem (but it's *really* ticking me off).

Yes, everything is spelled correctly. Yes, case is correct. If I type
"this.Ctrl" the auto-fill pulls up the correct name. It doesn't matter if I
use "CtrlSqlErrorDisplay1" or "this.CtrlSqlErrorDisplay1" - the former gives
me CS0103 the latter gives "'pgCodeTableCarrier' does not contain a
definition for 'CtrlSqlErrorDisplay1'". I have deleted and recreated the
file - same problem. When I rename the files (and the underlying class) the
problem goes away. Is this beast caching something somewhere that it refuses
to get rid or? Is there something magic about a class called
pgCodeTableCarrier as opposed to pgCodeTableFoo? What does Build Site do
that Build Page doesn't on a page-level?

thx
jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top