Many years later, in Visual Studio 2022, I've just had the same problem.
It occurred when I copied aspx files from one project to another within the same solution.
The namespaces in the new aspx, aspx.cs and aspx.designer.cs files still contained the name of the project from where they were copied, so I changed these to use the new project name. The code behind file still didn't recognise the names of the controls on the aspx page.
Then I noticed that the aspx.designer files hadn't been added to the project. They were in the correct location, but needed to be added manually by right clicking on them and selecting "Include in Project".
That fixed it.