中继器中并排放置多个桌子
只是想知道是否有人可以建议一种方法来更好地实现我使用以下标记所做的事情?
<asp:Repeater ID="rptGames" runat="server">
<HeaderTemplate>
<table>
<tr>
</HeaderTemplate>
<ItemTemplate>
<td>
<table>
<tr>
<td>Description:</td>
<td>Start time:</td>
<td>End time:</td>
<td>Game type:</td>
</tr>
<tr>
<td><%# Eval("Description") %></td>
<td><%# Eval("StartTime") %></td>
<td><%# Eval("EndTime") %></td>
<td><%# Eval("GameType") %></td>
</tr>
</table>
</td>
</ItemTemplate>
<FooterTemplate>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
有没有更好的方法来实现我想要的输出?
Just wondering if anyone can suggest a way to better implement what I am doing with the following markup?
<asp:Repeater ID="rptGames" runat="server">
<HeaderTemplate>
<table>
<tr>
</HeaderTemplate>
<ItemTemplate>
<td>
<table>
<tr>
<td>Description:</td>
<td>Start time:</td>
<td>End time:</td>
<td>Game type:</td>
</tr>
<tr>
<td><%# Eval("Description") %></td>
<td><%# Eval("StartTime") %></td>
<td><%# Eval("EndTime") %></td>
<td><%# Eval("GameType") %></td>
</tr>
</table>
</td>
</ItemTemplate>
<FooterTemplate>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
Is there a better way of achieving my desired output?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的代码将创建一行,您可能需要水平滚动才能看到所有项目
尝试使用
div
来实现,如下所示将这些类添加到您的
CSS
文件中,您可以根据您的设计调整 margin 、 padding 和 width 的值
your code will create one row and you may have to scroll horizontally to see all items
Try to do it using
div
s something like thisAdd these classes to your
CSS
fileyou can adjust values of margin , padding, and width according to your design
我的方法是使用 DataList 并将表格放入项目模板中,并将列数设置为 2 或您希望在一行中显示的任意数量。
The way I would do it would be to use the DataList and put the table in the item template and set the number of columns to 2 or however many you wanted to appear in a row.