Take the 2-minute tour ×

So, I'm working on this project between my laptop and my desktop.

The project works on the laptop, but now having copied the updated source code onto the desktop, I have over 500 errors in the project, all of them are...

The name does not exist in the current context

Here's one example...


<%@ Page Title="" Language="C#" MasterPageFile="~/Members/Members.master" AutoEventWireup="true" CodeFile="Jobs.aspx.cs" Inherits="Members_Jobs" %>

<%@ Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" TagPrefix="aj" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel runat="server" ID="upJobs">
            <!-- page content goes here -->


public partial class Members_Jobs : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            gvItems.Visible = false;

            pnlCallback.Visible = false;
            pnlInsurer.Visible = false;

    // more goes down here

Here's a sample of the designer.cs file...

namespace stman.Members {

    public partial class Jobs {

        /// <summary>
        /// upJobs control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.UpdatePanel upJobs;

I know this error means that the control being referenced generally doesn't exist or is not a part of the class that's referencing it, but as far as I can see, that isn't the case here.

Can anyone provide some insight?

VS2012 Screenshot

share|improve this question
Do you see the instance variables in the designer.cs file? –  Serge Sep 26 '13 at 11:32
Point in fact, I don't... just definitions for all the controls on the page –  Ortund Sep 26 '13 at 11:34
You will have a Designer.cs file. Delete it and regenerate. –  Bharadwaj Sep 26 '13 at 11:34
public partial class Members_Jobs and public partial class Jobs do not match –  Secret Squirrel Sep 26 '13 at 11:36
@SecretSquirrel So which one should it be? I assume the designer files need to have the Members_ on their class definitions –  Ortund Sep 26 '13 at 11:40
show 2 more comments

2 Answers

up vote 1 down vote accepted


This is the phyiscal file -> CodeFile="Jobs.aspx.cs"

This is the class which handles the events of the page -> Inherits="Members_Jobs"


This is the partial class which manages the page events -> public partial class Members_Jobs : System.Web.UI.Page

The other part of the partial class should be -> public partial class Members_Jobs this is usually the designer file.

you dont need to have partial classes and could declare your controls all in 1 class and not have a designer file.

EDIT 27/09/2013 11:37

if you are still having issues with this I would do as Bharadwaj suggested and delete the designer file. You can then right-click on the page, in the solution explorer, and there is an option, something like "Convert to Web Application", which will regenerate your designer file

share|improve this answer
I understand all that, but the problem persists. Please see my updated question with a screenshot of of the codefile and the designer side-by-side –  Ortund Sep 27 '13 at 8:32
Thanks Squirrel! I was unsure about how to regenerate the designer files... Can you explain why this should be necessary? I mean... What happened to the project? –  Ortund Sep 27 '13 at 10:55
@Ortund to be honest I do not know... if everything is referenced properly and all the controls exist, etc it should work... –  Secret Squirrel Sep 27 '13 at 11:51
would be nice if you could have saved the old designer file and then created the new one to see the difference :) –  Secret Squirrel Sep 27 '13 at 11:52
Do I have to this for each individual page? What if I add a page later, I have to do that to all the new ones too? The new page I created is the same as the old one :/ –  SiKni8 May 23 at 12:47
add comment

I came across a similar problem with a meta tag. In the designer.cs, the control was defined as:

protected global::System.Web.UI.HtmlControl.HtmlGenericControl metatag;

I had to move the definition to the .aspx.cs file and define as:

protected global::System.Web.UI.HtmlControl.HtmlMeta metatag;
share|improve this answer
add comment

Your Answer


