I've had an ongoing problem in my asp.net website, where I cannot access controls from the .cs file. It gives me the error: control not in context or whatever it normally does.
What's weird is that I have no designer.cs files or the option to convert to web application.
I've tried right clicking my project name, my file names, and everything else, but I cannot find "Convert To Web Application." I'm using Visual Studio 2013 Ultimate Edition and the latest versions of ASP.NET and stuff. For example, I have the following code in my page:
<asp:TextBox ID="AssignScreenName" runat="server" CssClass="form-control" Placeholder="Screen name"></asp:TextBox>
(It's for renaming yourself on your profile)
When in the Page_Load
class of my code behind, AssignScreenName.Text
will give me that error. I have to use Page.FindControl("AssignScreenName")
, which doesn't let me convert to text and assign it to the profile.
Is there a way around this, or a way to fix it? (If you need anymore information post it in the comments, I'll try to check back here daily)
Thanks!