hi all..
i'm working with slide show extender..
i'm referred to this website http://www.dotnetspider.com/resources/27734-Ajax-slide-show.aspx on how to make it..

it is completely tell the way to make it but i want to modified it to make it suitable with my requirement.. this is the code

using System;
using System.Data;
using System.Configuration;
using System.Collections;
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.Data.SqlClient;
//using FidesTech;

public partial class slideShowExtender2 : System.Web.UI.Page
    private static DataTable tblData = new DataTable();
    protected void Page_Load(object sender, EventArgs e)
        if (this.IsPostBack)return;
        SqlConnection db = new SqlConnection();
        string strSQL = "SELECT * FROM image";
        SqlConnection conn = new SqlConnection("Server=(local); Database=test; user id=sa; password=itdept");
        SqlCommand comm = new SqlCommand(strSQL, conn);
        SqlDataAdapter da = new SqlDataAdapter(comm);
        tblData = new DataTable();
        // set the initial image
if (tblData.Rows.Count > 0)
            string info = tblData.Rows[0]["imagePath"].ToString();
            string[] arInfo = new string[2];
            // define which character is seperating fields
            char[] splitter = { '/' };
            arInfo = info.Split(splitter);
            [B]imgShowImage.ImageUrl = "image/" + arInfo[2];[/B]        }
    public static AjaxControlToolkit.Slide[] GetSlides()
        AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[tblData.Rows.Count];
        string imagepath = "";
        for (int i = 0; i < tblData.Rows.Count; i++)
            DataRow dr = tblData.Rows[i];
            string info = dr["imagePath"].ToString();
            string[] arInfo = new string[1];
            // define which character is seperating fields
            char[] splitter = { '/' };
            arInfo = info.Split(splitter);
            imagepath = arInfo[2];
            slides[i] = new AjaxControlToolkit.Slide("image/" + imagepath, "Image name", "Image Description");
        return slides;
    protected void imgShowImage_Click(object sender, ImageClickEventArgs e)

i'm getting an error (bold code) said

Index was outside the bounds of the array.

in the website above, the image path in database is


but mine is


how can i change the array list? actually, i don't understand the way the splitter is count.. anybody plz help me..

thank in advance

Edited by new SE: n/a

6 Years
Discussion Span
Last Post by haseeb1431

you must debug the code. i dont know what is stored in the database. can you tell me the db record

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.