Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Error CS0103 (The name 'blah' does not exist in current context)

$
0
0

Hi,

Sorry if this is a dumb question but I am new to SharpDevelop. Firstly I think SharpDevelop is really great! It gives a decent alternative to MS Visual Studio especially for somebody like me who has been a slave to VS for years and seeks a way out, and dont want to pay a fortune to Micro$oft for their bloatware.  I have a website project that I developed in VS2010 which I am porting into SharpDevelop  (hooray!) .... but I have a slight problem that I need help with.  (I am sure this is simple to fix if you know what you're doing, which I don't).

I am getting Error CS0103 (The name 'blah' does not exist in current context) when I compile my project.  The reason is that I am not explicitly declaring my ASP.Net controls in the codebehind.

BUT - until now, I didn't need to?  Previously (when using VS for development) the .net compilation has not required the controls to be declared in the codebehind at all, it just needed them in the .aspx page and then I could refer to them in the .cs code directly.

For example if I have  <asp:TextBox id="MyTextBox" runat="server" etc ....> in the aspx page then I could refer to MyTextBox.Text in the code with no problem.  However when I compile with SharpDevelop it gives CS0103 error - which goes away if I add a declaration to the codebehind - eg. Protected TextBox MyTextBox.  But, surely I don't need to add this for every control on every page in my project?

Is this related to the .Net Framework version or something else eg. an option in SharpDevelop?  Maybe I need to add a reference or something?  Any ideas how I can get it to recognize the asp.net controls without having to declare them in the codebehind?

 

Thanks,

Owen


Viewing all articles
Browse latest Browse all 1764

Trending Articles