如何避免td与表格tr之间的单一空格? [英] How to avoid single space between td with in tr of a table?

查看:123
本文介绍了如何避免td与表格tr之间的单一空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何避免td与表格tr之间的单一空格?我正在使用VS 2005.在td中,标签和文本框变得不可见。



< pre lang =xml> < tr >
< td align = left style = height:28px >
< < span class =code-leadattribute> asp:Label ID = <跨度class =code-keyword> Label10 runat = 服务器 CssClass = C3_LABEL 宽度 = 152px 可见 = false > EstablishmentID < / asp:标签 > < / td >
< td align = left style = height:28px >
< asp:TextBox ID = txtEstablishmentID runat = 服务器 CssClass = C3_TEXTBOX MaxLength = 16 可见 = false

宽度 < span class =code-keyword> = 200px > < / asp:TextBox > < / td >
< td align = left style = 身高:28px >
< asp:标签 ID = Label11 runat = server CssClass = C3_LABEL 宽度 = 144px > Bank < / asp:Label > < / td >
< td align = left 样式 = 身高:28px > ;
< asp:DropDownList ID = ddlBank runat = server 宽度 = 205px OnSelectedIndexChanged = ddlBank_SelectedIndexChanged >
< / asp:DropDownList > < / td >
< < span class =code-leadattribute> / tr >

解决方案

您可以尝试这样..



为<$ c分配 ID $ c> TD ,并添加一个属性 runat =server

代码隐藏(。cs)每当你隐藏 TD控件(Label,Textbox)时,你可以隐藏 TD 以及使用可见属性...


另一个解决方案是使用javascript来知道td是否包含任何子控件,如果没有则隐藏/删除td。



使用jQuery你需要编写以下内容。



  var  selectedTds = 


' table')。find(' td')。filter( function (){
返回

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.

<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>

解决方案

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...


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.

var selectedTds =


('table').find('td').filter(function() { return


这篇关于如何避免td与表格tr之间的单一空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆