I am facing a small big problem. I have taken a dropdownList control and ID is
\"drpDownCountries
\" in ASP.Net project. The problem is that \"The dropdownlist contr
So first check that your ascx document is defined like so
ExampleClass.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ExampleClass.ascx.cs" Inherits="ExampleClass" %>
ExampleClass.ascx.cs
public partial class ExampleClass : System.Web.UI.UserControl
{
protected void Page_Load(object sender, System.EventArgs e)
{
}
}
It's possible there is an error in your aspx/aspx file that is causing the designer file not to be updated correctly. You could confirm this by adding something new (eg. "") and see if you can access that. If not, something is probably broken in the markup that you'll need to fix.
Right-click on the ASPX (or ascx) file, and select Convert to web application (or something like that). That will force a refresh on the designer file.
The only thing that worked for me was to add a temp controller in the aspx file and saving it. That generated the designer again, and my controllers are now recognized! I'm so proud. You can then remove the temp controller and save, it won't ruin anything, you scaredy cat!
Recreate the project. Just create a new project and add the elements one by one and hope it won't happen again. If it does, well that's part of the Microsoft experience: recreate another project and so on, until you decide to quit your job and join open-source.
CORRECTION
I'm going to redo the project that I have been working on since the last 3 days using ASP .NET MVC. I should be using an open-source tech for sure, but too bad it's not my decision for this project to not use .NET.
In aspx this type of error often occurs when you miss runat="server"