Reputation: 335
I am having a issue there I have this table with bunch of information in it they have under lines and etc there are 3 images they are dependant of some conditions and such. Here is the code:
<table id="Table1" cellspacing="1" cellpadding="1" width="661" border="0" class="auto-style3">
<tr>
<td align="center"><img alt="" src="../images" id="sign1" runat="server" style="height:80px" />
<asp:Label ID="lblUnderline1" runat="server" Text="____________________________"></asp:Label>
</td>
<td align="center"><img alt="" src="../images/" id="sign2" runat="server" style="height:80px" />
<asp:Label ID="lblUnderline2" runat="server" Text="____________________________"></asp:Label>
</td>
</tr>
<tr>
<td align="center" runat="server" id="Extra"><img alt="" src="../images" style="height:80px" id="sign3" runat="server" /><br />
<asp:Label ID="lblUnderline3" runat="server" Text="____________________________"></asp:Label>
</td>
</tr>
<tr>
<td align="center">
<asp:Label ID="lblTitle1" runat="server" Text="Vice President"></asp:Label>
</td>
<td align="center">
<asp:Label ID="lblTitle2" runat="server" Text=" Registrar"></asp:Label>
</td>
</tr>
</table>
Looks something like this:
If you see there is a big Gap in between the Sign1 and the line on top where its suppose to be right under. There is the 3rd image that's hidden it only comes out when the if statement says If(This condition){sign3.visible =true
But the gap between the line and the title is not going away I have tried this:
// Extra is the <tr> ID
Extra.Visible = false; Extra.Style.Add("display", "none");
Extra.Style.Add("width", "0px");
So is there a way to remove the whole tag out of the HTML from c# in a if condition such like
If(Condition This)
{
// Remove the <tr> Tag along the image in it
}
Upvotes: 0
Views: 1052
Reputation: 568
So As I looked through your code here it looks like you are trying to hide the td
that's inside a <tr>' yeah that worked it hides the
<td id=Extra but it doesnt hide the <tr
so try hiding the <tr>
<tr runat="server" id="Extra" >
<td align="center" ><img alt="" src="../images" style="height:80px" id="sign3" runat="server" /><br />
<asp:Label ID="lblUnderline3" runat="server" Text="____________________________"></asp:Label>
</td>
This will work with your current dynamic conditions
Extra.Visible = false;
Extra.Style.Add("display", "none");
Extra.Style.Add("width", "0px");Extra.Style.Add("height", "0px"); // Even this as your default height is 80px
Upvotes: 2