【发布时间】:2013-11-05 09:50:39
【问题描述】:
我想从数据库中获取一些图像并通过图像滑块显示这些图像。 为此,我想使用中继器控制。 请你说一下使用图像滑块中继器的简单方法是什么。
【问题讨论】:
标签: asp.net
我想从数据库中获取一些图像并通过图像滑块显示这些图像。 为此,我想使用中继器控制。 请你说一下使用图像滑块中继器的简单方法是什么。
【问题讨论】:
标签: asp.net
这是一种实现滑块中继器的方法:
<!--Your repeater with the <img /> tags for your slider (can be <li><img /></li> or other pattern)-->
<asp:Repeater ID="RptImages" runat="server" DataSourceID="SqlDataSourceMention">
<ItemTemplate>
<img src='<%# Eval("ImgPath") %>' alt="image-slider" />
</ItemTemplate>
</asp:Repeater>
<!--Your data source using stored procedure for this sample-->
<!--The "ConnectionString" attribute is set in your web.config file-->
<asp:SqlDataSource ID="SqlDataSourceImages" runat="server" ConnectionString="<%$ ConnectionStrings:YourconnectionString %>"
SelectCommand="YourStoredProcedureName" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
这将输出一个标签列表,其中 src 属性绑定在存储过程结果的“ImgPath”列上。
【讨论】: