title: ASP.NET panel visibility not working
body: <p>In my web page I have an update panel inside a division, however there are 4 link button and 4 panels. When I click on first link button I want 'panel1' to be visible and rest to be invisible, when second is clicked 'panel2' to be visible and rest invisible and so on. However this doesn't work all panels stay visible even if I click on any link button. Why does this happen?</p>
  
  <p>My code :</p>
  
  <pre><code>&lt;div class="container"&gt;    
      &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;    
      &lt;/asp:ScriptManager&gt;      
      &lt;div class="row"&gt;           
          &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
              &lt;ContentTemplate&gt;  
                  &lt;asp:LinkButton ID="BookAppointment" runat="server" Text="Book Appointment" OnClick="BookAppointment_Click"&gt;&lt;/asp:LinkButton&gt;   
                  &lt;asp:LinkButton ID="ViewBookings" runat="server" Text="View Bookings" OnClick="ViewBookings_Click"&gt;&lt;/asp:LinkButton&gt;   
                  &lt;asp:LinkButton ID="CancelBooking" runat="server" Text="Cancel Booking" OnClick="CancelBooking_Click"&gt;&lt;/asp:LinkButton&gt; 
                  &lt;asp:LinkButton ID="SearchDoctor" runat="server" Text="Search Doctor" OnClick="SearchDoctor_Click" &gt;&lt;/asp:LinkButton&gt;                            
              &lt;/ContentTemplate&gt;   
          &lt;/asp:UpdatePanel&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;div style="width: 870px; float:right;"&gt; 
              &lt;asp:Panel ID="Panel1" runat="server"&gt;
                  &lt;asp:Label ID="Label5" runat="server" Text="Book Appointment : "&gt;&lt;/asp:Label&gt;
                  &lt;br /&gt;
                  &lt;br /&gt;
                  &lt;asp:Button ID="Button2" runat="server" Text="9.00 - 9.30" CssClass="btn btn-primary" Width="120px"  OnClick="Button2_Click"&gt;&lt;/asp:Button&gt;  
                  &lt;asp:Button ID="Button3" runat="server" Text="9.30 - 10.00" CssClass="btn btn-primary" Width="120px"  OnClick="Button3_Click"&gt;&lt;/asp:Button&gt;  
                  &lt;asp:Button ID="Button4" runat="server" Text="10.00 - 10.30" CssClass="btn btn-primary" Width="120px"  OnClick="Button4_Click"&gt;&lt;/asp:Button&gt;  
                  &lt;asp:Button ID="Button5" runat="server" Text="10.30 - 11.00" CssClass="btn btn-primary" Width="120px"  OnClick="Button5_Click"&gt;&lt;/asp:Button&gt;  
                  &lt;asp:Button ID="Button6" runat="server" Text="11.00 - 11.30" CssClass="btn btn-primary" Width="120px"  OnClick="Button6_Click"&gt;&lt;/asp:Button&gt;  
                  &lt;asp:Button ID="Button7" runat="server" Text="11.30 - 12.00" CssClass="btn btn-primary" Width="120px"  OnClick="Button7_Click"&gt;&lt;/asp:Button&gt;
                  &lt;br /&gt;
                  &lt;br/&gt;
                  &lt;asp:Button ID="Button14" runat="server" Text="12.00 - 1.30 Break" CssClass="btn btn-danger" Enabled="False" Width="840px"&gt;&lt;/asp:Button&gt;
                  &lt;br /&gt;
                  &lt;br /&gt;
                  &lt;asp:Button ID="Button8" runat="server" Text="1.30 - 2.00" CssClass="btn btn-primary" Width="120px"  OnClick="Button8_Click"&gt;&lt;/asp:Button&gt;  
                  &lt;asp:Button ID="Button9" runat="server" Text="2.00 - 2.30" CssClass="btn btn-primary" Width="120px"  OnClick="Button9_Click"&gt;&lt;/asp:Button&gt;   
                  &lt;asp:Button ID="Button10" runat="server" Text="2.30 - 3.00" CssClass="btn btn-primary" Width="120px"  OnClick="Button10_Click"&gt;&lt;/asp:Button&gt;
                  &lt;asp:Button ID="Button11" runat="server" Text="3.00 - 3.30" CssClass="btn btn-primary" Width="120px"  OnClick="Button11_Click"&gt;&lt;/asp:Button&gt;  
                  &lt;asp:Button ID="Button12" runat="server" Text="3.30 - 4.00" CssClass="btn btn-primary" Width="120px"  OnClick="Button12_Click"&gt;&lt;/asp:Button&gt;  
                  &lt;asp:Button ID="Button13" runat="server" Text="4.00 - 4.30" CssClass="btn btn-primary" Width="120px"  OnClick="Button13_Click"&gt;&lt;/asp:Button&gt;
                  &lt;br/&gt;
                  &lt;asp:Button ID="Button21" runat="server" Text="04.30 - 6.30 Break" CssClass="btn btn-danger" Enabled="False" Width="840px"&gt;&lt;/asp:Button&gt;
                  &lt;br /&gt;
                  &lt;br /&gt;
                  &lt;asp:Button ID="Button22" runat="server" Text="6.30 - 7.00" CssClass="btn btn-primary" Width="120px"  OnClick="Button22_Click"&gt;&lt;/asp:Button&gt;
                  &lt;asp:Button ID="Button23" runat="server" Text="7.00 - 7.30" CssClass="btn btn-primary" Width="120px"  OnClick="Button23_Click"&gt;&lt;/asp:Button&gt;
                  &lt;asp:Button ID="Button24" runat="server" Text="7.30 - 8.00" CssClass="btn btn-primary" Width="120px"  OnClick="Button24_Click"&gt;&lt;/asp:Button&gt;
                  &lt;asp:Button ID="Button25" runat="server" Text="8.00 - 8.30" CssClass="btn btn-primary" Width="120px"  OnClick="Button25_Click"&gt;&lt;/asp:Button&gt;
                  &lt;asp:Button ID="Button26" runat="server" Text="8.30 - 9.00" CssClass="btn btn-primary" Width="120px"  OnClick="Button26_Click"&gt;&lt;/asp:Button&gt;
                  &lt;asp:Button ID="Button27" runat="server" Text="9.00 - 9.30" CssClass="btn btn-primary" Width="120px"  OnClick="Button27_Click"&gt;&lt;/asp:Button&gt;
                  &lt;br /&gt;
                  &lt;br /&gt;
                  &lt;asp:Button ID="Book" runat="server" Text="Book" CssClass="btn btn-success" Height="35px" Width="150px" OnClick="Book_Click" &gt;&lt;/asp:Button&gt;
                  &lt;br /&gt;
              &lt;/asp:Panel&gt;
              &lt;asp:Panel ID="Panel2" runat="server" &gt;
                  &lt;asp:Label ID="Label6" runat="server" Text="View Bookings : "&gt;&lt;/asp:Label&gt;&lt;br /&gt;
                  &lt;asp:Label ID="Label7" runat="server" Text="Booking History : "&gt;&lt;/asp:Label&gt;
                  &lt;asp:GridView ID="GridView1" runat="server"&gt;&lt;/asp:GridView&gt;
              &lt;/asp:Panel&gt;
              &lt;asp:Panel ID="Panel3" runat="server" &gt;
                  &lt;asp:Label ID="Label8" runat="server" Text="cancel"&gt;&lt;/asp:Label&gt;
              &lt;/asp:Panel&gt;
              &lt;asp:Panel ID="Panel4" runat="server" &gt;
                  &lt;asp:Label ID="Label9" runat="server" Text="doc"&gt;&lt;/asp:Label&gt;
              &lt;/asp:Panel&gt;
              &lt;br /&gt;
              &lt;br /&gt;
              &lt;br /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;asp:UpdatePanel ID="UpdatePanel2" runat="server"&gt;
                  &lt;ContentTemplate&gt;  
                      &lt;asp:Label ID="Label1" runat="server" Text="Appointment Id :   "&gt;&lt;/asp:Label&gt;
                      &lt;asp:TextBox ID="TextBox1" runat="server"  class="form-control" CssClass="text-info" ReadOnly="True"&gt;&lt;/asp:TextBox&gt; 
                      &lt;br /&gt;&lt;br /&gt;
                      &lt;asp:Label ID="Label2" runat="server" Text="For :   "&gt;&lt;/asp:Label&gt;
                      &lt;asp:DropDownList ID="DropDownList1" runat="server" CssClass="dropdown"&gt;&lt;/asp:DropDownList&gt;  
                      &lt;br /&gt;&lt;br /&gt;
                      &lt;asp:Label ID="Label3" runat="server" Text="Choose Doctor :   "&gt;&lt;/asp:Label&gt;
                      &lt;asp:DropDownList ID="DropDownList2" runat="server" CssClass="dropdown"&gt;&lt;/asp:DropDownList&gt; 
                      &lt;br /&gt;
                      &lt;br /&gt;
                      &lt;asp:Label ID="Label4" runat="server" Text="Date :   "&gt;&lt;/asp:Label&gt;&lt;asp:Calendar ID="Calendar1" runat="server"&gt;&lt;/asp:Calendar&gt;
                      &lt;br /&gt;
                      &lt;asp:Button ID="Button1" runat="server" CssClass="btn btn-success" OnClick="Button1_Click" Text="Check" /&gt;
                      &lt;br /&gt;
                      &lt;br /&gt;&lt;br /&gt;
                  &lt;/ContentTemplate&gt;   
              &lt;/asp:UpdatePanel&gt;
          &lt;/div&gt;
      &lt;/div&gt;               
  &lt;/div&gt;&lt;!--/.container--&gt;
  </code></pre>
  
  <p>and my server side code :</p>
  
  <pre><code>protected void BookAppointment_Click(object sender, EventArgs e)
  {
      Label1.Text = "book appointment";
      Panel1.Visible = true;
      Panel2.Visible = false;
      Panel3.Visible = false;
      Panel4.Visible = false;
  }
  
  protected void ViewBookings_Click(object sender, EventArgs e)
  {
      Label1.Text = "view bookings";
      Panel1.Visible = false;
      Panel2.Visible = true;
      Panel3.Visible = false;
      Panel4.Visible = false;
  }
  
  protected void CancelBooking_Click(object sender, EventArgs e)
  {
      Label1.Text = "cancel bookings";
      Panel1.Visible = false;
      Panel2.Visible = false;
      Panel3.Visible = true;
      Panel4.Visible = false;
  }
  
  protected void SearchDoctor_Click(object sender, EventArgs e)
  {
      Label1.Text = "search doc";
      Panel1.Visible = true;
      Panel2.Visible = false;
      Panel3.Visible = false;
      Panel4.Visible = true;
  }
  </code></pre>