문제

I have a slidediv. I am retrieving images from database where the file-path are saved.

Now I am using the below code to set image in the div. But I want to show my all images that are present in the database one by one after some seconds in the div. How to do that??

Code

protected void Page_Load(object sender, EventArgs e)
{
    string con = " ";
    con = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
    SqlConnection objsqlconn = new SqlConnection(con);
    objsqlconn.Open();
    SqlCommand cmd = new SqlCommand("SELECT * From pictable", objsqlconn);
    SqlDataReader grpIDreader = cmd.ExecuteReader();
    grpIDreader.Read();
    string path = grpIDreader["pic1"].ToString();
    slidediv.Attributes["style"] = String.Format("background-image:url('{0}')", path);
}

i want to get this done on pageload() from database and the images will show in the slidediv for some seconds each..

도움이 되었습니까?

해결책

You can do it by using simple ajax control inside Ajax-tool kit provided by Microsoft.

The link is http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/SlideShow/SlideShow.aspx

Or you need to use jQuery or Java-Script for the same.

Some Links

  1. jquery simple image slideshow tutorial
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top