asp中滚动公告代码,绑定数据库的如何做,高手帮忙啊!

我自己写了一段代码,将数据库里的公告内容调用出来显示,想让公告向上滚动,怎么实现啊??下面是我用formview写的数据绑定代码 <tr><td valign="top" style="border-left: #5960f6 1px solid;border-right: #5960f6 1px solid;border-bottom: #5960f6 1px solid; height:200px; width: 238px;" align="center"> <asp:Image ID="Image4" runat="server" ImageUrl="~/imges/jiaoxuegonggao.jpg" /><br /> <br /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT TOP (1) id, neirong FROM gonggao ORDER BY id DESC"></asp:SqlDataSource> <asp:FormView ID="FormView1" runat="server" DataKeyNames="id" DataSourceID="SqlDataSource1"> <EditItemTemplate> id: <asp:Label ID="idLabel1" runat="server" Text='<%# Eval("id") %>'></asp:Label><br /> neirong: <asp:TextBox ID="neirongTextBox" runat="server" Text='<%# Bind("neirong") %>'> </asp:TextBox><br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="更新"> </asp:LinkButton> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="取消"> </asp:LinkButton> </EditItemTemplate> <InsertItemTemplate> neirong: <asp:TextBox ID="neirongTextBox" runat="server" Text='<%# Bind("neirong") %>'> </asp:TextBox><br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="插入"> </asp:LinkButton> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="取消"> </asp:LinkButton> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="neirongLabel" runat="server" Text='<%# Bind("neirong") %>'></asp:Label><br /> </ItemTemplate> </asp:FormView> </td></tr>好用的高分送上啊
2026-12-04 15:52:05
推荐回答(1个)
回答1:

先把datalist加上数据源,然后再调出来数据的时候加上滚动的代码就行了