how to check if a control of a certain type?
<p>When I use th below code, it works. All the controls are hidden.</p>

<pre><code>foreach (Control ctr in eItem.Controls)
{
    ctr.visible = false;                  
}
</code></pre>

<p>However, I want to hide only labels and dropdownlists. That why I'm trying to use the below code without success</p>

<pre><code>foreach (Control ctr in eItem.Controls)
{
    if(ctr is Label | ctr is DropDownList)
    {
       ctr.visible = false;
    }              
}
</code></pre>

<p><strong>EDIT</strong></p>

<p>Here's the whole method</p>

<pre><code> private void HideLabelAndDDLOnPageLoad()
    {
        foreach (ListViewItem eItem in lsvTSEntry.Items)
        {
            foreach (Control ctr in eItem.Controls)
            {
                if (ctr is Label || ctr is DropDownList)
                {
                    ctr.Visible = false;
                }  
            }
        }
    }
</code></pre>

<p>When I remove the if, all the controls get hidden. When I put it back, nothing happens.</p>

<p>Thanks for helping</p>
