Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9130309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:56:31+00:00 2026-06-17T07:56:31+00:00

Using Visual Studio 2010, I added a form to an ASP.Net page that was

  • 0

Using Visual Studio 2010, I added a form to an ASP.Net page that was already part of my project. Call it myPage.aspx. I was actually copying and pasting the form from a working page in another application. So first I pasted the .aspx code into myPage.aspx file and then the C# code into the myPage.aspx.cs file. I did not copy over the page directive in the myPage.aspx file, and I did not copy over any of the class declaration code in the myPage.aspx.cs file. I only pasted a table into the body of myPage.aspx and some submit handling code into myPage.aspx.cs.

When I tried to build the web site, I got errors for every single control saying “The name ‘whateverControl’ does not exist in the current context”. This made no sense to me because the Intellisense was working, finding the controls just fine. I double checked the CodeFile and Inherits attributes of the Page and they were all correct.

Furthermore, if I used the “Build Page” command, the page built successfully. It was only if I used “Build Web Site” that I got the long list of “does not exist” errors. “Rebuild Web Site” did not help. I even shutdown Visual Studio and reopened it and it made no difference. I eventually found the problem, so I am answering my own question here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:56:32+00:00Added an answer on June 17, 2026 at 7:56 am

    It turned out that myPage.aspx and myPage.aspx.cs were completely fine. The problem was that at some previous time, someone else had copied the .aspx page (not the .aspx.cs) I was working on to two other .aspx pages and they had also copied the CodeFile and Inherits attributes when they did this. So both of those pages had the exact same CodeFile and Inherits settings as the page I was working on. That meant three pages had these exact same settings in their Page directive:

    CodeFile=”myPage.aspx.cs” Inherits=”myPage”

    Apparently this is allowed by the compiler, and it works as long as there is no code in the .aspx.cs file that is looking for controls that only exist in one of the pages.

    I removed those attributes from the two other copied pages and then everything compiled successfully.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m trying to write a basic ASP.NET form (using Visual Studio 2010) to submit
I am using Visual Studio 2010 to create a setup project for my .NET
Using Visual Studio 2010 I created an Office 2010 Word add-in project that has
I'm trying to design a webpage using Asp.net and CSS in Visual Studio 2010.
I am using Visual Studio 2010 along with the Infragistics WebDropDown tool for ASP.NET
I'm using Visual Studio 2010 In my project I was added a local database
Using: Visual Studio 2010 with ASP.net 4.0 I have a website which uses URL
I have a Setup project that I have build using Visual Studio 2010. The
I'm using ASP.NET web forms in Visual Studio 2010. How can I create UI
I am using Visual Studio 2010 SP1 Ultimate on a c# class library project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.