【问题标题】:remove blank space in item and table border of table删除表格的项目和表格边框中的空格
【发布时间】:2013-08-03 09:27:25
【问题描述】:

我有下表:

其实这是一张支付方式为<tr>的表格

在另一个<tr>中绘制图表

和 Grid 在同一个<tr> 在另一个<td>

我只是想删除网格和表格边框之间的多余空间。

为此,我将网格设置为不同的宽度,但空间总是随之而来。 (正如我在红色标记中提到的)。

我怎样才能删除那个空间?

请帮帮我。

为了更清楚,下面是我的表结构的代码:

<table cellpadding="0" cellspacing="0" width="25%">
    <tr>
        <td align="left" class="NormalText" colspan="2" style="font-weight: bold">
            By Payment mode
        </td>
    </tr>
    <tr>
        <td align="left" style="width: 30%" valign="top">
            <asp:Label ID="LblChartMonthTransPaywise" runat="server"></asp:Label>
        </td>
        <td align="left" valign="top" >
            <asp:GridView ID="GrdChartMonthTransPaywise" runat="server" AutoGenerateColumns="false"
                CellPadding="2" CellSpacing="2" ShowFooter="true" ShowHeader="false" Width="100%">
                <RowStyle CssClass="NormalText" VerticalAlign="Top" />
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <%#Eval("PaymentMode")%>
                        </ItemTemplate>
                        <FooterTemplate>
                            Total:
                        </FooterTemplate>
                        <FooterStyle CssClass="NormalText" Font-Bold="true" HorizontalAlign="Right" />
                        <ItemStyle Width="40%" />
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="LblAmt" runat="server" CssClass="NormalText"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Right" Width="30%" />
                        <FooterTemplate>
                            <asp:Label ID="LblFootAmt" runat="server" CssClass="NormalText" Font-Bold="true"></asp:Label>
                        </FooterTemplate>
                        <FooterStyle HorizontalAlign="Right" Width="30%" />
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="LblAmtPercentage" runat="server" CssClass="NormalText"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </td>
    </tr>
</table>

【问题讨论】:

  • 只需将第二个 td 设置为 70%..
  • @Raghubar 先生,我做到了,但请告诉我任何技巧,除了 100i.e 之外,我怎样才能带来 100 的 % 符号。它在另一行,我想避免它(网格的第三列)
  • 最好提供生成的html代码来使用沙盒,比如jsfiddle
  • @Anton 好的,但这不会显示图形,因为它不能生成图形(我为在服务器端生成图形而编写的支持函数)

标签: c# html asp.net .net vb.net


【解决方案1】:

我通过将margin-right:100px 设置为上面的gridview 来做到这一点,如下所示。

<td align="left" valign="top" style="margin-right:100px" >

【讨论】:

    猜你喜欢
    • 2015-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多