Search code examples
c#asp.netpanelvisibilityshow

Show / Hide Panel with 1 imagebutton


I'm new to asp.net and C#. Right now, I'm creating a small webpage with panels etc.

Situation: I got a Panel (let's say Panel1). And an Imagebutton (Button1). I can Show the Panel (onclick event) in aspx with visible = true.

Problem: How do I close the Panel using the same button? I dont want to use Javascipt or jquery or anything else that is Client site.

Is there a simple solution for that?


Solution

  • Forgive my ignorance if this isn't available in ASP.NET but could you not do something like

    Button1_ServerClick(object sender, EventArgs e) 
    {
        Panel1.Visible = !Panel1.Visible; //toggles visibility
    }