Click here to Skip to main content
15,904,494 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to avoid single space between td with in tr of a table?I am using VS 2005. In td the label and textbox are made invisible.

XML
<tr>
                               <td align="left" style="height: 28px">
                                   <asp:Label ID="Label10" runat="server" CssClass="C3_LABEL" Width="152px" Visible="false">EstablishmentID</asp:Label></td>
                               <td align="left" style="height: 28px">
                                   <asp:TextBox ID="txtEstablishmentID" runat="server" CssClass="C3_TEXTBOX" MaxLength="16" Visible="false"
                                       Width="200px"></asp:TextBox></td>
                               <td align="left" style="height: 28px">
                                   <asp:Label ID="Label11" runat="server" CssClass="C3_LABEL" Width="144px">Bank</asp:Label></td>
                                 <td align="left" style="height: 28px">
                                   <asp:DropDownList ID="ddlBank" runat="server" Width="205px" OnSelectedIndexChanged="ddlBank_SelectedIndexChanged">
                                   </asp:DropDownList></td>
                           </tr>
Posted

hi you can try like this..

Assign an ID to the TD , and add an attribute as runat="server"
and in the code behind (.cs) whenever you are hiding the TD controls(Label,Textbox), you can hide the TD as well using the Visible property...
 
Share this answer
 
Another solutions is to use javascript to know if the td contains any child control or not, if not then hide/remove the td.

Using jQuery you need to write the following.

JavaScript
var selectedTds = $('table').find('td').filter(function() {
    return $(this).children().length == 0;
});
selectedTds.hide() / selectedTds.remove();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900