473,569 Members | 3,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Control does not exist in the current context

26 New Member
G'day,

I have encontered what appears to be a common problem, but unfortunately the typical solution i have found has not worked for me.

I have just copied the files from an "ASP .NET Web Site" to an "ASP .NET Web Application" because i have learned about the differences and have decided to move to the latter. I simply copied and pasted all the .aspx (with respective .aspx.cs code-behind files) and some other files such as scripts etc into the "Web Application". I have also added the same references to class libraries I had in the "Web Site".

When I come to compile the "Web Application", I get errors saying that controls "cannot be found in the current context". I did not get these errors in the "Web Site" and the common problem apparently is that there are backup files or duplicate partial classes, which i'm certain is not the case for me...

One example is that I have an ASP:PlaceHolder in header.aspx as follows...

<asp:Placeholde r runat="server" ID="headermenuh older">

...but i get the error "The name 'headermenuhold er' does not exist in the current context"

I would be VERY greatful if someone could give me their opinion! :)

Best Regards,
Chris
Jul 4 '09 #1
6 28425
cbellew
26 New Member
Sorted.

Turned out i wasn't aware that in "ASP .NET Web Application" projects there needed to be both .cs and .designer for each page. I created a new page by going to add item and the correct .designer page was created, so i copied the code from the old version, deleted the old version and recompiled and it worked!

Thanks anyway :)
Jul 4 '09 #2
cbellew
26 New Member
Even Better!

Right click on the file and choose "Convert to Web Application" - feel a bit silly now!

Thanks
Jul 4 '09 #3
praveenb000
21 New Member
ok, u got it, and nice to share with us
Jul 5 '09 #4
rathinakumarb
1 New Member
Even silly things are great for unknown like me ... Thanks a lot .. I too had probelm in converting the website to web project

Thanks to cebellew !!!
Nov 11 '09 #5
Frinavale
9,735 Recognized Expert Moderator Expert
It's good to know how you solved your solution.
I didn't realize that you can see this error in the case when the .designer file is missing (normally this file isn't missing because it's typically automatically generated for you by Visual Studio....I can see how it would be a problem if it were missing).

Usually when this type of error shows up someone is trying to use something that they aren't allowed to use in the Global.asax file.

Well, at least that's when I encountered this error.

The Global.asax file is a tricky thing. In some methods things like Session are available and then in other methods it is not. It's a little confusing when you first start using the Global.asax but once you realize what it's for things start making sense.

-Frinny
Nov 11 '09 #6
HA! hours of messing about was driving me to drink. literally.

Rightclick project, convert to web application.

Done deal.

Thanks cbellew.
Oct 21 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5597
by: aarepasky | last post by:
I am using ASP Web 2005 express and I have a textbox in a user control. Now when I try to use it in another user control, I get the error that it "does not exist in current context. These 2 user controls are each in a panel on the page. riprip
2
9905
by: Jeff | last post by:
hey asp.net 2.0 (C'#) In the code behind file I have this method: public String AddBR(Object param) { String text = (String) param; return text; }
2
13508
by: The.Relinator | last post by:
Hello, I seem to be getting the following error in one class, but not in a form. The name 'Invoke' does not exist in the current context. The code I am trying to execute is: Invoke(d, new object { text }); all my using statements are: using System;
5
6927
by: nudrat | last post by:
I included a control TextBox with 'txtError' name. whenever I build this I get this error. The name 'txtError' does not exist in the current context But its running on last successful Build. I tried deleting deafult.aspx page from project, then building the project, then adding again the deafult.aspx in Project. But nothing worked. Please...
0
1907
by: Dave | last post by:
I have an ASPX page that I can't seem to do anything with the dropdowns. The error that I'm getting is "The name 'EmployeeDropdownList' does not exist in the current context. I have all the necessary references in place...System.Web...System.Web.UI.WebControls.... Why am I getting the context error when trying to Databind a dropdown...
2
3055
by: =?Utf-8?B?QyNub3ZpY2U=?= | last post by:
Like my name says I am a total novice at C#. I am trying to following examples in a book that I have but unfortunately they do not provide you with code for the whole project. Up till now I could figure out what is causing my problems but now I am stuck. I added in the books code into a Windows Application: using System; using...
1
2987
by: avecreep | last post by:
Hi, i was trying to find a web application and i found one open source on the internet. i put the code folders on the root folder and when i tried to acces via web browser it all worked fine ( i am using IIS). But i want to make some custom changes on the forms and some functionalites. To do so, i created my own project on Visual Studio 2005,...
0
1444
by: Terry | last post by:
Hello, I have problem adding controls to my webpage default.aspx. There is a group of controls that just refuse to be used with message: 'The name 'controlname' does not exist in the current context' I researched a web and found that similar problem exists around but somehow I cannot get solution. Interesting thing is that if do run...
3
8277
by: MiziaQ | last post by:
I'm trying to authenticate the user login in c#. I get the following 2 errors: 'the name 'login_username' does not exist in the current context' and 'the name 'login_password' does not exist in the current context'. index.aspx <tr> <td>&nbsp;</td> <td> <asp:TextBox ID="login_username"...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.