桌子内放错了位置
因此,我尝试在表中填充 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您启动了一个ItemTemplate,而无需先声明表。所以:
正确的事情是首先声明表:
You started an ItemTemplate without first declaring the table. So:
the correct thing is to declare the table first: