Click here to Skip to main content
15,888,175 members
Articles / Web Development / XHTML

Slide-Show User Control

Rate me:
Please Sign up or sign in to vote.
4.91/5 (49 votes)
23 Jun 2008CPOL7 min read 198.6K   4.3K   116  
This article describes how to create a slide-show user control with the help of the DataList control.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SlideShow1.ImageDataSource = GetImageItems();
    }

    private ImageItems GetImageItems()
    {
        ImageItems oImageItems = new ImageItems();
        ImageItem oImageItem = null;

        FileInfo[] Images = new DirectoryInfo(Server.MapPath("Images")).GetFiles("*.*");

        foreach (FileInfo Image in Images)
        {
            oImageItem = new ImageItem();

            oImageItem.URL = string.Format("~/Images/{0}", Image.Name);
            oImageItem.ToolTip = Image.Name;

            oImageItems.Add(oImageItem);
        }

        return oImageItems;
    }

    protected void SlideShow1_Click(object sender, SlideShowImageEventArgs e)
    {

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Infogain India Pvt Ltd
India India


Samir NIGAM is a Microsoft Certified Professional. He is an insightful IT professional with results-driven comprehensive technical skill having rich, hands-on work experience n web-based applications using ASP.NET, C#, AJAX, Web Service, WCF, jQuery, Microsoft Enterprise Library , LINQ, MS Entity Framework, nHibernate, MS SQL Server & SSRS.



He has earned his master degree (MCA) from U.P. Technical University, Lucknow, INDIA, his post graduate dipoma (PGDCA ) from Institute of Engineering and Rural Technology, Allahabad, INDIA and his bachelor degree (BSc - Mathematics) from University of Allahabad, Allahabad, INDIA.



He has good knowledge of Object Oriented Programming, n-Tier Architecture, SOLID Principle, and Algorithm Analysis & Design as well as good command over cross-browser client side programming using JavaScript & jQuery,.



Awards:



Comments and Discussions