Domanda

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..

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top