【发布时间】:2018-12-13 13:47:06
【问题描述】:
我正在尝试在中继器中使用 css。当我运行它时,没有格式化。但是,当我在中继器之外使用 css 时,它的格式很好。
<style>
body {
background-color:lightgray
}
.messageBox p {
background-color:white;
width: 25%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
外接中继器
<div class="messageBox">
<p>The quick brown fox jumped over the lazy dog</p>
<p>The quick brown fox jumped over the lazy dog</p>
<p>The quick brown fox jumped over the lazy dog</p>
<p>The quick brown fox jumped over the lazy dog</p>
<p>The quick brown fox jumped over the lazy dog</p>
</div>
中继器内部
<asp:Repeater ID="myRepeater" runat="server">
<ItemTemplate>
<br />
<div class="messageBox">
<p>
<%# Eval("Message") %>
</p>
</div>
</ItemTemplate>
</asp:Repeater>
【问题讨论】:
-
检查页面并查看转发器是否正在生成具有正确名称的 div 类 'messagebox'。