Compiler errors on the main page

Does anyone have any advice on moving the homepage from one solution / app to another?

I copied the master page from the existing solution to the new one.

The original solution builds and works fine.

In new solution, page throws build errors

It is primarily a "variable" not declared.

I have commented out all of the server code for the page except for two very simple statements.

Operator

1 refers to a control that is in the markup of the original page

pgLoginView.EnableViewState = True

      

Statement 2 refers to a control that was recently added for testing purposes

lblFrogs.Text = "sdfgsd"

      

It's as if the compiler doesn't know the class members to be generated from the markup. I checked the markup attributes. The inherited attribute is set correctly. When I call intellisense in the code editor, both objects (lblFrogs and pgLoginView) are listed and in turn correctly list their properties and methods after clicking "."

Any help or ideas related to this issue is greatly appreciated. I'm at my end - it was a short trip.

+2


source to share


4 answers


I finally found the source of my grief with the Profile object.

First, the profile functionality is only available in a website type project. However, since the project was already converted to a website type to address the first issue with linking to page elements, why wasn't the profile object available?



The answer is that the transformation does not change the markup of the page. The location of the code behind must be specified using "CodeFile", and the Inherits attribute must contain information about the leading namespace. Example:

0


source


You should check the generated developer code for your master page, although at runtime the .aspx / .master page is used to instantiate all the controls on your page at compile time all the information about which controls are present in the markup is contained in the partial class in file .designer.master:

public partial class Site1
{
    /// <summary>
    /// ContentPlaceHolder1 control.
    /// </summary>
    /// <remarks> Auto-generated field.</remarks>
    protected global::System.Web.UI.WebControls.ContentPlaceHolder ContentPlaceHolder1;

    // Etc...
}

      



If this page does not contain correctly generated code, I am not sure what to suggest other than playing with it, or if you are really stuck declare the controls yourself - I had this problem before but I don’t know how much developer code is generated ...

If that's not a problem, are you sure visual studio hasn't decided to rename any of the controls?

+1


source


christian-hayter Seemed to be on the right track. I converted the project to a website project and the problem went away.

It looks like the root cause may remain a mystery.

0


source


Something has definitely gone berserk with the compilation for this page.

I am unable to reference the Profile property. This is an article from Dino Esposito Says the Profile object is added to the page as part of the compilation process as follows:

protected Profile ProfileCommon {get {return ((ProfileCommon) (Context.Profile)); }}

When I do a file search for ProfileCommon in a working project, I am getting a lot of results from asp.net temp files. In a broken project, ProfileCommon does not appear in any of the files.

0


source







All Articles