【问题标题】:Unkown whitespace occurs above table (in asp.net datalist)表上方出现未知空格(在 asp.net 数据列表中)
【发布时间】:2020-05-15 11:19:28
【问题描述】:

我创建的表格上方有一个未知的空白。当我检查代码时,有
和 's 但我从未使用过它们。会不会是因为我不使用 tbody 和 thead 而出现的?当我删除检查中的所有中断和跨度时,它是正确的。

<div class="container" style="overflow:auto">
            <table class="table table-striped">
            <tr>
                <th scope="col"></th>
                <th scope="col">Product</th>
                <th scope="col">Voorraad</th>
                <th scope="col" class="text-center">Aantal</th>
                <th scope="col" class="text-right">Prijs</th>
                <th scope="col"></th>
            </tr>
            <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:webshopConnectionString %>" providername="<%$ ConnectionStrings:webshopConnectionString.ProviderName %>" selectcommand="SELECT tblbestelling.Aantal, tblproducten.ProductID, tblproducten.ProductNaam, tblproducten.ProductAfbeelding, tblproducten.ProductPrijs, tblproducten.ProductVoorraad FROM tblbestelling INNER JOIN tblproducten ON tblbestelling.ProductID = tblproducten.ProductID"></asp:sqldatasource>
            <asp:Datalist runat="server" datakeyfield="ProductID" datasourceid="SqlDataSource1" repeatlayout="Flow">

        <ItemTemplate>
                <tr>
                    <td>
                        <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("ProductAfbeelding", "~/imgs/{0}") %>' style="height:50px; width:50px" />
                    </td>
                    <td>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("ProductNaam") %>'></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("ProductVoorraad") %>'></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("Aantal") %>'></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="Label4" runat="server"></asp:Label>
                    </td>
                    <td>
                        <asp:LinkButton ID="Button1" runat="server" CssClass="text-danger" Text="Button"><i class='fa fa-trash'></i></asp:LinkButton>
                    </td>
                </tr>
        </ItemTemplate>
    </asp:Datalist>
        </table>
    </div>

【问题讨论】:

  • 你能发一张问题的图片吗?
  • 已编辑 - 我做了。
  • 您检查过桌子上的“检查”选项吗?因为可能这个表上有一个style有影响,也可能和asp.net无关
  • 还有容器和表格的 CSS 代码......
  • 我添加了一张图片!

标签: html css asp.net


【解决方案1】:

看到有人在下一页询问类似问题的一件事:https://forums.asp.net/t/1315224.aspx?extra+white+space+after+listview+ItemTemplate+ 是在任何地方的数据中是否有任何额外的空格。在链接的案例中,我相信他们只是使用了文字,但值得一看。

【讨论】:

    【解决方案2】:

    问题很奇怪,但我只需要输入RepeatDirection="Horizontal",它似乎就可以了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-11
      • 1970-01-01
      相关资源
      最近更新 更多