【问题标题】:How can use Repeater control for Image slider control?如何使用Repeater控件进行图像滑块控件?
【发布时间】:2013-11-05 09:50:39
【问题描述】:

我想从数据库中获取一些图像并通过图像滑块显示这些图像。 为此,我想使用中继器控制。 请你说一下使用图像滑块中继器的简单方法是什么。

【问题讨论】:

    标签: asp.net


    【解决方案1】:

    这是一种实现滑块中继器的方法:

        <!--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”列上。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多