Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.Net <control> does not exist in current context

Tags:

c#

asp.net

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 control is placed on page, in the code behind file of c#, while typing the control name "drpDownCountries", this control ID is listed in object member list. But, in compiling the project I am getting following error.

Error : - The name 'drpDownCountries' does not exist in the current context.

I have checked this thing on different machines too. But same error is occurring. I do not understand what is the reason behind that.

like image 487
Kamlesh Avatar asked Mar 05 '11 14:03

Kamlesh


People also ask

Does not exist in the current context ASP NET core?

Many a times while writing a code we get this error which says, “The name does not exists in the current context”. This is because the code behind file is not able to find the control being added to your aspx file.

What is ASPX CS file?

The aspx file contains your page markup. It's automatically converted into code by ASP.NET. The cs file contains the code behind your page (initialization, event handlers, etc.). You have to write that code yourself.


1 Answers

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.

like image 73
kprobst Avatar answered Oct 12 '22 06:10

kprobst