Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
please help me out..
 
The label has id in the UI.. but in code behind if i use the id of label...it is showing error saying lblmessage doesn't exist in the current context..
<asp:Label runat="server" ID="lblMessage" Text="" class="multi">
 
if i use the above id in code behind am getting error
lblMessage.Text += fileName + "Uploaded";
Posted 24-Jan-13 19:02pm
v3
Comments
Sergey Alexandrovich Kryukov at 25-Jan-13 0:14am
   
Nothing exist until you create it. The question makes no sense at all. What help do you expect? That someone find some declaration in your own files?
—SA
Azziet at 25-Jan-13 0:27am
   
check your files properly...aspx...And cs both should inherited same class...although question is not clear
Tadit Dash at 25-Jan-13 1:35am
   
Please build your project properly. Or else delete that label and recreate it once more and build again.
sarathkumarnallathambi at 25-Jan-13 3:12am
   
hi ,

Have u copied from the control from some other page.. Or else Version change (2010 to 2008) or website to application???

 
So ,tel me if u did anything from these???
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Probably, you are missing the closing tag: Have you deleted the slash from the end?
<asp:Label runat="server" ID="lblMessage" Text="" class="multi">
Becomes
<asp:Label runat="server" ID="lblMessage" Text="" class="multi"/>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

if you are not missing the closing tag check if label has same id as you are trying to use in .cs file.
otherwise delete this add a new label give it a different name '' and build the solution and after that use it in .cs file
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

build your website once then use label in code behind. sometimes it works.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.150129.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100