Make HtmlControl invisible

T

Tim Mulholland

If i have an HtmlControl for a table row such as:

<tr id="trMyRow" runat="server">...</tr>

is there any way to set this to be invisible by default through the HTML
code, without having to go through the codebehind?

<tr id="trMyRow" runat="server" visible="false">...</tr> does not work.

its kind of a pain to have to put a whole bunch of lines like

trMyRow.Visible = false;

for each one i want to be invisible by default.

Any help is appreciated.
Thanks in advance,

-Tim
 
S

Shiva

One option is to use the CSS:
<tr id="trMyRow" runat="server" style="display:none;">...</tr>

If i have an HtmlControl for a table row such as:

<tr id="trMyRow" runat="server">...</tr>

is there any way to set this to be invisible by default through the HTML
code, without having to go through the codebehind?

<tr id="trMyRow" runat="server" visible="false">...</tr> does not work.

its kind of a pain to have to put a whole bunch of lines like

trMyRow.Visible = false;

for each one i want to be invisible by default.

Any help is appreciated.
Thanks in advance,

-Tim
 
T

Tim Mulholland

to undo that, i'll have to edit the style, right? i won't be able to use the
visible property?
hmm. iguess i can just test that myself...
 
S

Steven Cheng[MSFT]

Hi Tim,

As for the HtmlControl ,we can also set the "Visible" property inline
within the aspx page template, for example:

<table width="100%" border="1">
<tr id="trOne" runat="server" Visible="false">
<td>Table Row One</td>
</tr>

..................

Also, if you use the CSS style such as ,
<table width="100%" border="1">
<tr id="trOne" runat="server" style="display:none">
<td>Table Row One</td>
</tr>

then, you can use the

trOne.Style["display"] = "inline";
to reset it.

Hope this help. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
T

Tim Mulholland

I could swear i had tested that before and it didn't work.
But, alas, it does!
Thanks so much.

-Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top