0

I have an aspx page that my colleague designed for me to stick on the back end. I made a few alterations to the page, adding various controls and things - and now the compiler doesn't recognize any of the controls on the page! The Intellisense is working just fine - I can type txtName. and as I push the . all the properties of a TextBox pop up as normal... but when I try compile, the compiler says "Name 'txtName' is not declared".

There's obviously a secret switch somewhere. Any ideas what it might be?

EDIT: I just realized the difference between this form and every other form in the project: there's no .aspx.designer.vb file. Any idea how to force generation of this file?

Shaul Behr
  • 36,951
  • 69
  • 249
  • 387

3 Answers3

3

I have had a similar problem and it came down to the namespace declaration for the code behind file in the ASPX file

<%@ Page Language="VB" MasterPageFile="~/AdminMasterPage.master" AutoEventWireup="false"
    CodeFile="AdminConsoleAudit.aspx.vb" Inherits="AdminConsoleAudit" Title="Untitled Page"
    StylesheetTheme="cs" Strict="true" %>

This has to change to a

<%@ Page Language="VB" MasterPageFile="~/AdminMasterPage.master" AutoEventWireup="false"
    CodeFile="<namespaceHere>.AdminConsoleAudit.aspx.vb" Inherits="AdminConsoleAudit" Title="Untitled Page"
    StylesheetTheme="cs" Strict="true" %>

HTH

Dean
  • 5,896
  • 12
  • 58
  • 95
0

Sounds like it cannot find the code behind file.

It may be that you have a hardcode path somewhere, if you have the code in a different directory than you colleague, then you could get this problem.

If this is what is causing the problem then there are 2 ways to fix it:

  • place all code in same directory structure
  • use relative paths

It could also be that you have not copied all the required files. Try searching for txtName in your code.

Shiraz Bhaiji
  • 64,065
  • 34
  • 143
  • 252
0

Got the answer! The .aspx.designer.vb file was missing. And here is how to get it back.

Community
  • 1
  • 1
Shaul Behr
  • 36,951
  • 69
  • 249
  • 387