Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sever controls are hidden in VS2005?

Status
Not open for further replies.

jennifercheng2008

Programmer
Jul 24, 2008
10
CA
I spend hours today in this problem:
It looks the controls are hidden during compile.
In the c# code, I can see the controls. When I write "this.", the controls can show in the popup window.
But compile the code, I got error message "_Default' does not contain a definition for 'UserNameTextBox'".

It happened to other controls. Why these controls are hidden by VS2005? Any idea to avoid this problem?

My aspx code here:

<%@ Page
Language="C#"
MasterPageFile="PageMaster.Master"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default" %>
...
<asp:TextBox ID="UserNameTextBox" runat="server" >
...

C# code here:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String test3 = this.UserNameTextBox.Text;
}
}


By the way, when I right click "UserNameTextBox" and select "go to definition", get error message "the definition of the object is hidden"

Thanks very much.

Jennifer
 
delete the page and recreate it. this usually fixes anomalies with VS code generation.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Hi Jason,

I deleted the old codes, and create new one. It is worse this time. I even can't see the controls.

When I write "this.", the controls (textbox and label) can't show in the popup window.

Is there any problem with my VS2005?

Thanks.

Jennifer
 
Strange thing happened!

First I can't see controls in c#. After I changed aspx code to design view, and back to "source view", I can see the controls in c# code. But when compile, still get the same error message in my first post.

Any advice will be appreciated.

Jennifer
 
try restarting Visual Studio. If that doesn't fix the problem try repairing VS. The designer code should "just work". Other than that I'm out of ideas.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
It's too bad. restart of vs can't fix this problem. i should reinstall vs.

Thanks.

Jennifer
 
Just figured it out.

After C# code's property (Build action) from "content" to "embedded resource", everything is ok.

Jennifer
 
good to here you solved the problem.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top