title: asp:label change visibility after hiding it
body: <p>I've got an <code>asp:Label</code> and a <code>asp:DropDownList</code> that I want to be able to switch back and forth between visible and invisible when clicking on some buttons. Right now, my code looks like</p>
  <h3>aspx file</h3>
  <pre><code>&lt;asp:Label AssociatedControlID=&quot;statusFilter&quot; id=&quot;statusFilterLabel&quot; runat=&quot;server&quot; CssClass=&quot;filterLabel&quot;&gt;Status
      &lt;asp:DropDownList ID=&quot;statusFilter&quot; runat=&quot;server&quot; CssClass=&quot;filterInput&quot; AutoPostBack=&quot;true&quot; OnSelectedIndexChanged=&quot;anyFilter_SelectedIndexChanged&quot; AppendDataBoundItems=&quot;True&quot;&gt;
          &lt;asp:ListItem Selected=&quot;True&quot; Value=&quot; 0&quot;&gt;&amp;lt;All&amp;gt;&lt;/asp:ListItem&gt;
      &lt;/asp:DropDownList&gt;
  &lt;/asp:Label&gt;
  &lt;asp:Button Text=&quot;ALL&quot; ID=&quot;AllTabButton&quot; CssClass=&quot;tabButton&quot; runat=&quot;server&quot; OnClick=&quot;AllTab_Click&quot; /&gt;
  &lt;asp:Button Text=&quot;Arrived&quot; ID=&quot;ArrivedTabButton&quot; CssClass=&quot;tabButton&quot; runat=&quot;server&quot; OnClick=&quot;ArrivedTab_Click&quot; /&gt;
  </code></pre>
  <h3>code behind</h3>
  <pre><code>    protected void AllTab_Click(object sender, EventArgs e)
      {
          AllTabButton.CssClass = &quot;tabButtonClicked&quot;;
          ArrivedTabButton.CssClass = &quot;tabButton&quot;;
          statusFilter.Visible = true;
          statusFilterLabel.Visible = true;
      }
      protected void ArrivedTab_Click(object sender, EventArgs e)
      {
          AllTabButton.CssClass = &quot;tabButton&quot;;
          ArrivedTabButton.CssClass = &quot;tabButtonClicked&quot;;
          statusFilter.Visible = false;
          statusFilterLabel.Visible = false;
      }
  </code></pre>
  <p>The only problem is that if I try to set <code>Visible=true</code> after setting <code>Visible=false</code> it would give me an error <code>Unable to find control with id 'statusFilter' that is associated with the Label 'statusFilterLabel'.</code></p>
  <p>I tried doing some other things instead of using Visible, like setting the style: <code>statusFilter.Style.Add(&quot;display&quot;, &quot;block&quot;)</code> and setting the cssclass: <code>statusFilter.CssClass = &quot;displayBlock&quot;</code>but the resulting error always showed up.</p>
  <p>An asp:Panel would work, but I'm avoiding using that because I want my asp:Label and asp:DropDownList to line up with several other labels and dropdownlists; putting in a panel would make them not line up properly.</p>
  <p>I'm guessing there is something I'm missing, something I just don't get, but I can't seem to figure out what that is. If anybody has any clue as to what's happening, I would really appreciate the help!</p>