在asp.net中从db设置html图像滑块 [英] set html image slider from db in asp.net

查看:66
本文介绍了在asp.net中从db设置html图像滑块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
i save my photos in db , and i want set image url from my db to html slider what am i do?
i want , admin can set img src from his control panel or can set it from file that save in db with fileuploader

推荐答案

hi

您必须在项目中使用jquery幻灯片并应用数据绑定控件(datarepeater或datalist和...)请google jquery图像滑块并应用itemtemplate生成与数据源绑定的img标签,例如数据库等

它很容易请按照以下步骤操作:



step1:转到此地址并使用jquery滑块。

http://chocoslider.alandawi.com.ar/index_en.html [< a href =http://chocoslider.alandawi.com.ar/index_en.htmltarget =_ blanktitle =新窗口> ^ ]



step2:而不是

hi
You must use jquery slides in your project and apply data bound controls(datarepeater or datalist and ...) please google jquery image slider and apply itemtemplate for generating img tag bounded with data source such as database and etc.
it''s easy please following under steps:

step1:go to this address and use jquery slider.
http://chocoslider.alandawi.com.ar/index_en.html[^]

step2:instead
<div id="slider">
	<img src="img/img_1.jpg" alt="" title=""/>
	<img src="img/img_2.jpg" alt="" title=""/>
	<img src="img/img_3.jpg" alt="" title=""/>
	<img src="img/img_4.jpg" alt="" title=""/>
	<img src="img/img_5.jpg" alt="" title=""/>
</div>





使用此代码:





use this code:

<div id="slider">
    <asp:Repeater ID="slider_rep" runat="server">
      <ItemTemplate>
		<img src='<%# Eval("image column name") %>' alt="" title=""/>		
      </ItemTemplate>
    </asp:Repeater>	
</div>	







在你的asp页面中

并将其数据源设置为数据库



祝你好运。




in your asp page
and set its datasource to database

With best regards.


你可以通过jquery和ajax做到这一点,但如果你不想让它更简单,



请按照以下步骤操作:





1.制作一个asp页面,根据传递给它的id返回数据库中的图像。



-id可以通过查询字符串传递,



-并通过设置response.cont返回图像entType =image mime extension

并在response.BinaryWrite()中传递数据库中的图像byte []


2.给imm-src属性中具有图像id的asp页面的路径。



- 使用image-id部分(其中提及查询字符串)网址动态。





现在管理员必须只传递他想要在滑块中添加的图片的ID 。



试试吧。



最佳运气:)
You can do it through jquery and ajax thing, but if you wan''t to make it simpler,

Follow these steps:


1.Make an asp page which returns the image from database based on the id passed to it.

-id can be passed through query string,

-and image is returned by setting the response.contentType="image mime extension"
and passing the image byte[] from the database in response.BinaryWrite()

2.Give the path of the asp page in the imm-src property with the id of the image.

-make the image-id part(where u mention query string) in the url dynamic.


Now admin has to just pass the id''s of the images that he wanted to add in the slider.

Try it.

Best Of Luck :)


这篇关于在asp.net中从db设置html图像滑块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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