Typically all visible/not visible type manipulation should be done with Javascript client side. Using jQuery
and pointing to the ID of an element to hide it is trivial. However, since you have decided to use an ASP.NET
server side control in the way of a TableHeaderCell
, you can change its .Visible
property server side in the C#
code if you wish:
if (isSomeCondition)
{
this.TableHeaderCell1.Visible = false;
}
You will have to assign an ID
to that control in the markup as well to have it's handle:
<asp:TableHeaderCell id="TableHeaderCell1">
I still heavily opt for a client side approach to hiding elements, and you can still do this with the following syntax:
$('#<%= TableHeaderCell1.ClientID %>').hide();