Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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..
XML
<asp:Label runat="server" ID="lblMessage" Text="" class="multi">


if i use the above id in code behind am getting error
C#
lblMessage.Text += fileName + "Uploaded";
Posted
v3
Comments
Sergey Alexandrovich Kryukov 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 25-Jan-13 0:27am    
check your files properly...aspx...And cs both should inherited same class...although question is not clear
[no name] 25-Jan-13 1:10am    
Can you plz check your page is saved or not and rebuild the page and check in the code behind for the lblMessage.
Please build your project properly. Or else delete that label and recreate it once more and build again.
Sarathkumar Nallathamby 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???

Probably, you are missing the closing tag: Have you deleted the slash from the end?
ASP.NET
<asp:Label runat="server" ID="lblMessage" Text="" class="multi">
Becomes
ASP.NET
<asp:Label runat="server" ID="lblMessage" Text="" class="multi"/>
 
Share this answer
 
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
 
Share this answer
 
build your website once then use label in code behind. sometimes it works.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900