-
Hiding table rows
Hi,
I have a table (this is a basic example, but my table is slightly more complex):
Code:
<table>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
Inside the table cells I have some .NET controls.
While the page loads I get some data from the DB and depending on that data I need to hide/show certain table rows.
What I have done in the past is instead of multiple <td>'s I use 1 and add a panel in there with another table in that and then I hide/show the panel.
But in this case I need the table rows hidden.
I can do this by saying:
Code:
if(data.Equals("XC"))
{
Control1.Visible = false;
Control2.Visible = false;
Control3.Visible = true;
}
However, I want to avoid this method if possible.
Any ideas?
Woof
-
Re: Hiding table rows
If this is all server side in the pageLoad event you can runat=server the table and show hide the <tr>, <td> tags, optionally you could set a css style on the tr/td tags where the controls are on the page just not visible.
-
Re: Hiding table rows
yea, that's what i started using...then paused...and decided to ask here 1st ;)
If I had done it all like that, someone would have only said "Tut ut...you should have done it like this...."
:D
Woof
-
Re: Hiding table rows
I'd like to know the better way too, It's all just show/hide a table row, panel or div depending on the markup you want isn't it.
-
Re: Hiding table rows
This is the correct way. I have spoken.