例如:
<div id="Hot_News" >
<marquee behavior="scroll" direction="up" scrollamount="2" behavior="alternate" onmouseover="this.setAttribute('scrollamount', 0, 0);" onmouseout="this.setAttribute('scrollamount', 6, 0);">
<asp:Repeater ID="rep_marq" runat="server" >
<ItemTemplate>
<ul class="marquee">
<li class="marquee_li">
<a href='<%# Eval("NewsID","../Public_Pages/ShowNewsPage.aspx?NID={0}") %>'>
<asp:Label ID="Label3" runat="server" Text='<%#Eval("NewsTitr") %>'></asp:Label>
</a>
</li>
</ul>
</ItemTemplate>
</asp:Repeater>
</marquee>
</div>
在后面的代码中:
public void fillrepeter()
{
try
{
var db = new DataClassesDataContext();
var fill = (db.TblNews.Select(p => p)).Take(5).ToList();
if (fill != null)
{
rep_marq.DataSource = fill;
rep_marq.DataBind();
}
}
catch (Exception)
{
throw;
}
}