Click here to Skip to main content
Sign Up to vote bad
good
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 - 18:02
Edited 24 Jan '13 - 19:28
Tadit Dash23.2K

Comments
Sergey Alexandrovich Kryukov - 25 Jan '13 - 0:14
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:27
check your files properly...aspx...And cs both should inherited same class...although question is not clear
sisir patro - 25 Jan '13 - 1:10
Can you plz check your page is saved or not and rebuild the page and check in the code behind for the lblMessage.
Tadit Dash - 25 Jan '13 - 1:35
Please build your project properly. Or else delete that label and recreate it once more and build again.
sarathkumarnallathambi - 25 Jan '13 - 3:12
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???

3 solutions

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  
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  
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)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 239
1 OriginalGriff 188
2 Mahesh Bailwal 139
3 Maciej Los 135
4 Aarti Meswania 98
0 Sergey Alexandrovich Kryukov 10,214
1 OriginalGriff 7,819
2 CPallini 4,181
3 Rohan Leuva 3,522
4 Maciej Los 3,089


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid