Valerie Meunier

Valerie Meunier

  • NA
  • 693
  • 84.2k

Label1 doesn't exist in current context

May 8 2021 8:54 AM
Hi
 
this code gives the error "Label1 doesn't exist in current context":
 
aspx-code
  1. <asp:Button ID="Button1" runat="server" />  
  2. <asp:Label ID="Label1" runat="server" ></asp:Label><br />  
code-behind:
  1. partial class oop : System.Web.UI.Page    
  2. {    
  3. protected void Button1_Click(object sender, System.EventArgs e)    
  4. {    
  5. Label1.Text = "ok";    
  6. }    
  7. } 
Thanks for help.

Answers (2)