The name lblorder does not exist in the current context label
<asp:Label ID="lblorder" runat="server" Text="Ordernumber: "></asp:Label>
code behind
string test = lblorder.Text;
I hate this error.
Once in a while it just pops up and I know that it has something to do with deleting the aspx.designer.cs and rebuilding the page or solution file but I work in Visual Web Developer 2008 Express Edition and I dont have this aspx.designer.cs file
..help me..
You could always open the visual studio solution and add the xml for the file.
<Compile Include="blahblah\blahblah.ascx.cs">
<DependentUpon>blahblah.ascx</DependentUpon>
</Compile>
Once you delete the aspx.designer.cs you should be able to right click on the .aspx file and click "Convert to Web Application". This will regenerate you aspx.designer.cs file.
I created a webapplication of the website solution , so now I have aspx.designer.cs files and can clean the solution and convert it to a webapplication, but the error still exists ..
So I just added the missing line in the designer file, now it works ; protected global::System.Web.UI.WebControls.Label lblorder;
but this is not a perminent solution; the changes are deleted after every built ....
and then she found it that you have to use a findcontrol when labels etc are placed in a nested repeater
I too had the same problem but I fixed it by providing the directive in the aspx file (html file)
The above format and content can be obtained by making a new web application project and copything the above similar directive that is automatically generated by visual studio!!