Asp – User control IDs not Being Recognized in Code-behind after Port to WAP

asp.net

I copied over all my files from my Web Site Project to the root of my new WAP project. Now none of my user controls IDs in my .aspx pages are being recognized in the related code-behind pages and not sure why.

For example, our Master Page has the following user control referenced:

<%@ Register Src="Navbar.ascx" TagName="Navbar" TagPrefix="mc" %>

and in the Master Page it's being used:

<td id="tdNavBar"><mc:Navbar runat=server id="navbar"></mc:Navbar></td>

but now, some of the code in my Master.cs that was referencing navbar no longer knows about it.

Best Answer

If they're not recognised in your code behind file, double check that they have been declared in the .designer.cs file. If they are not there, try manually adding them and see if that works correctly.

You might also want to try manually creating a new user control using the File --> New Item option to check that it isn't to do with when you copy and pasted the items in (i.e. they could have the wrong namespace, etc).