trying to hide a panel of Master Page in my content page using the following code
Panel p = this.Master.FindControl("panel1") as Panel;
p.Visible = false; //Error is showing on this line
Why this error ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I suspect you’ve got the code like this:
You can’t just put code in the class like that – everything other than declarations (e.g. fields) needs to be in a method: