处理来自数据库的图像到jQuery的图像交换技术 [英] handling images from database to jquery image swapper

查看:128
本文介绍了处理来自数据库的图像到jQuery的图像交换技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

反正有处理从数据库中图像的jquery图像交换技术或任何其他类型的图像交换技术。
图像应当取决于从DATABSE生成的图像的数量来填充。我可以得到所有的
从DATABSE图像,但我不能找到一种方式来显示对jQuery的图像交换技术的图像。
我可以通过使用DataList控件显示所有图像但有数据表我不能使用jQuery的图像交换技术。
任何可能的解决方案或替代将是非常美联社preciated

 保护无效showDetails(INT makeID)
{
    conn.Open();
    CMD的SqlCommand =新的SqlCommand(选择价格,形象,从产品详情使凡(makeID LIKE @makeID),conn);在
    的SqlParameter参数=新的SqlParameter();   param.ParameterName =@makeID;
    cmd.Parameters.Add(参数);
  // cmd.Parameters [@ makeID]值= makeID。
   param.Value = makeID;    RDR = cmd.ExecuteReader();
    而(rdr.Read())
    {
       // Label3.Text = RDR [价格]的ToString()。        lblMake.Text = RDR [让]的ToString()。
        lblPrice.Text = RDR [价格]的ToString()。        atest2.Attributes [HREF] =〜/图片/+ RDR [图像2]的ToString()。        test2.Attributes [SRC] =〜/图片/+ RDR [图像2]的ToString()。
        test2.Attributes [高度] =75;
        test2.Attributes [宽度] =75;    }    conn.Close();}

//在设计视图

 < D​​IV ID =页>
        < D​​IV ID =容器>            < H2>缩略图翻转效果和幻灯片播放淡入淡出< / H>            <! - 开始高级画廊的HTML容器 - >
            < D​​IV ID =画廊级=内容>
                < D​​IV ID =控制级=控制>< / DIV>
                < D​​IV CLASS =幻灯片容器>
                    < D​​IV ID =加载类=装载机>< / DIV>
                    < D​​IV ID =幻灯片级=幻灯片>< / DIV>
                < / DIV>
                < D​​IV ID =标题级=标题容器>< / DIV>
            < / DIV>
                    <立GT;
                        <一类=拇指NAME =滴ID =atest2称号=标题#1=服务器>
                            < IMG ID =test2的=服务器ALT =标题#1/>
                        &所述; / A>
                        < D​​IV CLASS =标题>
                            任何HTML可以放在这里...
                        < / DIV>
                    < /李>
< / UL>
            < / DIV>
            < D​​IV的风格=明确:既;>< / DIV>
        < / DIV>
    < / DIV>


解决方案

您可以使用asp.net中继器来创建所需的HTML标记。

 < D​​IV ID =页>
    < D​​IV ID =容器>        < H2>缩略图翻转效果和幻灯片播放淡入淡出< / H>        <! - 开始高级画廊的HTML容器 - >
        < D​​IV ID =画廊级=内容>
            < D​​IV ID =控制级=控制>< / DIV>
            < D​​IV CLASS =幻灯片容器>
                < D​​IV ID =加载类=装载机>< / DIV>
                < D​​IV ID =幻灯片级=幻灯片>< / DIV>
            < / DIV>
            < D​​IV ID =标题级=标题容器>< / DIV>
        < / DIV>< D​​IV ID =大拇指>
    < UL类=大拇指无脚本>
        < ASP:直放站ID =rptImages=服务器>
        <&ItemTemplate中GT;
            <立GT;
                <一类=拇指NAME =optionalCustomIdentifier的href =路径/要/幻灯片称号=你的形象称谓>
            < IMG SRC ='<%#的String.Format(/图像/ {0}的eval(图像))%GT;' ALT = /&GT你的形象了完美的降级又题;
                &所述; / A>
                < D​​IV CLASS =标题>
                    (任何HTML可以去这里)
                < / DIV>
            < /李>
            ......(重复库中的每幅图像)
        < / ItemTemplate中>
        < / ASP:直放站>
    < / UL>
< / DIV> < D​​IV的风格=明确:既;>< / DIV>
    < / DIV>
< / DIV>

只需将您的图像列表图像tagss内绑定到这个中继器和输出它们的路径。

这对你的工作?

修改

有关你身后的code会希望做一些更喜欢这个下面,我已经更新上面的code,以显示你的输出。

  RDR = cmd.ExecuteReader();
rptImages.DataSource = RDR;
rptImages.DataBind();

Is there anyway of handling images from database to jquery image swapper or any other type of image swapper. the images should be populated depending on the number of images generated from the databse. I can get all the images from the databse but I cant find a way to show those images on the jquery image swapper. I can display all the images by using datalist but with data list i cant use the jquery image swapper. Any possible solution or alternative will be highly appreciated

 protected void showDetails(int makeID)
{
    conn.Open();
    SqlCommand cmd = new SqlCommand("Select Price,image,make from productDetail Where (makeID LIKE @makeID)"  , conn);
    SqlParameter param = new SqlParameter();

   param.ParameterName = "@makeID";
    cmd.Parameters.Add(param);
  //  cmd.Parameters["@makeID"].Value = makeID;
   param.Value = makeID;

    rdr = cmd.ExecuteReader();
    while (rdr.Read())
    {
       // Label3.Text = rdr["price"].ToString();

        lblMake.Text = rdr["make"].ToString();
        lblPrice.Text = rdr["Price"].ToString();

        atest2.Attributes["href"] = "~/images/" + rdr["image2"].ToString();

        test2.Attributes["src"] = "~/images/" + rdr["image2"].ToString();
        test2.Attributes["height"] = "75";
        test2.Attributes["width"] = "75";

    }

    conn.Close();

}

// on the design view

<div id="page">
        <div id="container">

            <h2>Thumbnail rollover effects and slideshow crossfades</h2>

            <!-- Start Advanced Gallery Html Containers -->
            <div id="gallery" class="content">
                <div id="controls" class="controls"></div>
                <div class="slideshow-container">
                    <div id="loading" class="loader"></div>
                    <div id="slideshow" class="slideshow"></div>
                </div>
                <div id="caption" class="caption-container"></div>
            </div>
                    <li>
                        <a class="thumb" name="drop" id="atest2" title="Title #1" runat="server" >
                            <img  id="test2" runat="server" alt="Title #1" />
                        </a>
                        <div class="caption">
                            Any html can be placed here ...
                        </div>
                    </li>
</ul>
            </div>
            <div style="clear: both;"></div>
        </div>
    </div>

解决方案

You can use an asp.net repeater to create the html markup needed.

<div id="page">
    <div id="container">

        <h2>Thumbnail rollover effects and slideshow crossfades</h2>

        <!-- Start Advanced Gallery Html Containers -->
        <div id="gallery" class="content">
            <div id="controls" class="controls"></div>
            <div class="slideshow-container">
                <div id="loading" class="loader"></div>
                <div id="slideshow" class="slideshow"></div>
            </div>
            <div id="caption" class="caption-container"></div>
        </div>

<div id="thumbs">
    <ul class="thumbs noscript">
        <asp:Repeater id="rptImages" runat="server">
        <ItemTemplate>
            <li>
                <a class="thumb" name="optionalCustomIdentifier" href="path/to/slide" title="your image title">
            <img src='<%#String.Format("/images/{0}", Eval("image"))%>' alt="your image title again for graceful degradation" />
                </a>
                <div class="caption">
                    (Any html can go here)
                </div>
            </li>
            ... (repeat for every image in the gallery)
        </ItemTemplate>
        </asp:Repeater>        
    </ul>
</div>

 <div style="clear: both;"></div>
    </div>
</div>

Just bind your List of images to this repeater and output their paths within the image tagss.

This work for you?

EDIT

For your code behind you would want to do something more like this below, and i have updated the code above to show your output.

rdr = cmd.ExecuteReader();
rptImages.DataSource = rdr;
rptImages.DataBind();

这篇关于处理来自数据库的图像到jQuery的图像交换技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆