桌子内放错了位置

发布于 2025-01-18 12:08:09 字数 5175 浏览 2 评论 0原文

因此,我尝试在表中填充 ItemRepeater。但我认为缩进中存在某种错误。代码是这样的:

                                        <div class="card-body border-bottom bg-white">
                                            <asp:UpdatePanel ID="upFromHome" runat="server">
                                                <ContentTemplate>
                                                    <asp:ListView ID="lsHome" runat="server">
                                                        <LayoutTemplate>
                                                            <div class="col">
                                                                <table runat="server" id="tableHome" class="table-bordered table-striped mb-0 table table-responsive">
                                                                    <thead>
                                                                        <tr style="text-align: center; font-size: 12px;">
                                                                            <th scope="col">Employee Id</th>
                                                                            <th scope="col">Type</th>
                                                                            <th scope="col">Day</th>
                                                                            <th scope="col">Month</th>
                                                                            <th scope="col">Year</th>
                                                                            <th scope="col">Status</th>
                                                                        </tr>
                                                                    </thead>
                                                                    <tr runat="server" id="itemPlaceholder">
                                                                </table>
                                                        </LayoutTemplate>
                                                        <ItemTemplate> //error is here
                                                            <tbody>
                                                                <tr runat="server" style="text-align: center; background-color: white; font-size: 11px;">
                                                                    <th runat="server" style="text-align: center;">
                                                                        <asp:Label ID="lblUsername" runat="server" Text='<%#Eval("username") %>'></asp:Label></th>
                                                                    <th runat="server" style="text-align: center;">
                                                                        <asp:Label ID="lblTipo" runat="server" Text='<%#Eval("tipo") %>' /></th>
                                                                    <td runat="server" style="text-align: left;">
                                                                        <asp:Label ID="lblDay" runat="server" Text='<%#Eval("fecha") %>' /></td>
                                                                    <td runat="server" style="text-align: left;">
                                                                        <asp:Label ID="lblMes" runat="server" Text='<%#Eval("regHorario") %>' /></td>
                                                                    <td runat="server" style="text-align: left;">
                                                                        <asp:Label ID="lblAno" runat="server" Text='<%#Eval("status") %>' /></td>
                                                                    <td runat="server" style="text-align: center;">
                                                                        <asp:Button runat="server" ID="status1" class="btn btn-success" Text="Approved" /></td>
                                                                </tr>
                                                            </tbody>
                                                        </ItemTemplate>
                                                    </asp:ListView>
                                    </div>
                                            </div>
                                </div>
                            </div>
                        </div>
                        </ContentTemplate>
                            </asp:UpdatePanel>

                        </div>

但即便如此,asp 中的代码运行良好......我在前端遇到错误。这是错误:

System.Web.UI.HtmlControls.HtmlTableCellCollection debe tener elementos de tipo 'System.Web.UI.HtmlControls.HtmlTableCell'. 'ItemTemplate' es de tipo 'System.Web.UI.HtmlControls.HtmlGenericControl'.

显然它在某些 div 节点中放错了位置,但这是我第一次收到此错误。

So, I tried to fill in a ItemRepeater inside a table. But I think there is some kind of error, in the indentation. Code is like this:

                                        <div class="card-body border-bottom bg-white">
                                            <asp:UpdatePanel ID="upFromHome" runat="server">
                                                <ContentTemplate>
                                                    <asp:ListView ID="lsHome" runat="server">
                                                        <LayoutTemplate>
                                                            <div class="col">
                                                                <table runat="server" id="tableHome" class="table-bordered table-striped mb-0 table table-responsive">
                                                                    <thead>
                                                                        <tr style="text-align: center; font-size: 12px;">
                                                                            <th scope="col">Employee Id</th>
                                                                            <th scope="col">Type</th>
                                                                            <th scope="col">Day</th>
                                                                            <th scope="col">Month</th>
                                                                            <th scope="col">Year</th>
                                                                            <th scope="col">Status</th>
                                                                        </tr>
                                                                    </thead>
                                                                    <tr runat="server" id="itemPlaceholder">
                                                                </table>
                                                        </LayoutTemplate>
                                                        <ItemTemplate> //error is here
                                                            <tbody>
                                                                <tr runat="server" style="text-align: center; background-color: white; font-size: 11px;">
                                                                    <th runat="server" style="text-align: center;">
                                                                        <asp:Label ID="lblUsername" runat="server" Text='<%#Eval("username") %>'></asp:Label></th>
                                                                    <th runat="server" style="text-align: center;">
                                                                        <asp:Label ID="lblTipo" runat="server" Text='<%#Eval("tipo") %>' /></th>
                                                                    <td runat="server" style="text-align: left;">
                                                                        <asp:Label ID="lblDay" runat="server" Text='<%#Eval("fecha") %>' /></td>
                                                                    <td runat="server" style="text-align: left;">
                                                                        <asp:Label ID="lblMes" runat="server" Text='<%#Eval("regHorario") %>' /></td>
                                                                    <td runat="server" style="text-align: left;">
                                                                        <asp:Label ID="lblAno" runat="server" Text='<%#Eval("status") %>' /></td>
                                                                    <td runat="server" style="text-align: center;">
                                                                        <asp:Button runat="server" ID="status1" class="btn btn-success" Text="Approved" /></td>
                                                                </tr>
                                                            </tbody>
                                                        </ItemTemplate>
                                                    </asp:ListView>
                                    </div>
                                            </div>
                                </div>
                            </div>
                        </div>
                        </ContentTemplate>
                            </asp:UpdatePanel>

                        </div>

But even tho, the code behind in asp works well... I am getting an error in the frontend. This is the error:

System.Web.UI.HtmlControls.HtmlTableCellCollection debe tener elementos de tipo 'System.Web.UI.HtmlControls.HtmlTableCell'. 'ItemTemplate' es de tipo 'System.Web.UI.HtmlControls.HtmlGenericControl'.

Apparently it is misplaced in some div node, but this is the first time I am getting this error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

在风中等你 2025-01-25 12:08:09

您启动了一个ItemTemplate,而无需先声明表。所以:

      <ItemTemplate> //error is here
       <tbody>
       <tr runat="server" style="text-align: center; background-color: white; font-size: 11px;">

正确的事情是首先声明表:

<ItemTemplate> //error is here  
 <table>
  <thead>
    <tr>
      <th></th>
    </tr>
  </thead>
  <tbody>
   <tr runat="server" style="text-align: center; background-color: white; font-size: 11px;">
    </tr>
        ...
   </tbody>
 </table>

You started an ItemTemplate without first declaring the table. So:

      <ItemTemplate> //error is here
       <tbody>
       <tr runat="server" style="text-align: center; background-color: white; font-size: 11px;">

the correct thing is to declare the table first:

<ItemTemplate> //error is here  
 <table>
  <thead>
    <tr>
      <th></th>
    </tr>
  </thead>
  <tbody>
   <tr runat="server" style="text-align: center; background-color: white; font-size: 11px;">
    </tr>
        ...
   </tbody>
 </table>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文