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
I had this same problem and tried all the answers listed here, to no avail.
What finally worked for me was to make a change to the ascx file in Design view and then save it. This finally forced Visual Studio to regenerate the designer.cs file and include my new control.
Do not let Intellisense fool you. Sometimes (usually after fixing problems with duplicate class names), you simply need to rebuild the project and the reported errors go away. Reopening the file after the build might be necessary.
I have seen this error occur when there is a copy of the .aspx page in the project folder.
Example:
Error occurs in Test.aspx.
There is a Test-copy.aspx file in the project folder.
Delete, rename with a different extension, or move Test-copy.aspx to a different folder.
Error is resolved.
You should put some code to get help..
Anyway, the problem could be that drpDownCountries is contained within a Panel control.
The Panel control is a Container control, in that it can hold lots of controls.
In order to access the controls within that Panel control, you first need to "help" ASP.Net to find it.
The typical way of doing this is to use the FindControl method look here.
Code sample:
DropDownList myDrop = (DropDownList)this.Panel1.FindControl("drpDownCountries");
if(myDrop != null)
{
..somecode..
}