c# - Error ::Invalid token '=' in class, struct, or interface member declaration -


trying hide panel of master page in content page using following code

 panel p = this.master.findcontrol("panel1") panel;    p.visible = false; //error showing on line 

why error ?

i suspect you've got code this:

class mypage : page {     panel p = this.master.findcontrol("panel1") panel;       p.visible = false; } 

you can't put code in class - other declarations (e.g. fields) needs in method:

class mypage : page {     public void page_load(object sender, eventargs e)     {         panel p = this.master.findcontrol("panel1") panel;           p.visible = false;     } } 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -