I don’t get it. I added an asp:Label in my aspx. page:
<asp:Label runat="server" Text="" ID="lblStatus"></asp:Label>
then when I try to set the text in the code behind:
lblStatus.Text = " test";
, it gives me this error:
An object reference is required for the non-static field, method, or property 'Utilities_MoveFileTemplate.lblStatus'
I am trying to set the label’s text in the codehind after a stored procedure has run:
try
{
conn.Open();
cmd.ExecuteNonQuery();
lblStatus.Text = "success";
}
removed “static” keyword and it worked
It looks like you are calling a non static property from a static method or in static class. You will need create an instance of Form.