I have a project that was previously built by someone else. When I try to add a new control to the page, I can\'t access it in the code behind. When I try to access it there
I had a similar problem. I faced this problem when I tried to rename the aspx file. In my case, the class name was not updated from UpdateRecords to ModifyRecords when I renamed the aspx file to ModifyRecords. Hence none of the ASP.NET controls were accessible from the code behind.
Code behind before renaming:
public partial class UpdateRecords : System.Web.UI.Page
Code behind after renaming:
public partial class ModifyRecords : System.Web.UI.Page
If you try to rename aspx file or copy-paste from different file, just make sure, the class name is updated.