Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Ajax
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Ajax the combination of XHTML, CSS, DOM, XML, XSLT, XMLHttpRequest, and JavaScript
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ajax section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 1st, 2010, 07:39 PM
Authorized User
Join Date: Apr 2009
Location: Sardinia - Italy
Posts: 48
Thanks: 16
Thanked 0 Times in 0 Posts
Default Ajax toolkit SlideShowextender with data from page method

Hi there,
I am trying to make an AjaxToolkit SlideSHow extender work.
The extender sits in a contentpage, with the scriptmanager in the masterpage. The problem seems to be that the private static DataTable declared in the code behind as global, does not keep its data until the page method called by the extender needs it. I put in a gridview just to see if the data comes back from the database, and that works. Also feeding the page method hard coded images works.

The mark up is :

 <asp:Panel ID="Panel1" runat="server">
            <asp:Label ID="lblImgTitle" runat="server"></asp:Label>
            <asp:Image ID="imgShowImage" runat="server" 
                Style="border: 1px solid black;width:auto" 
                AlternateText="" />
            <asp:Label runat="server" ID="lblImage"/><br /><br />
            <asp:Button runat="server" ID="prevButton" Text="Prev" Font-Size="Larger" />
            <asp:Button runat="server" ID="playButton" Text="Play" Font-Size="Larger" />
            <asp:Button runat="server" ID="nextButton" Text="Next" Font-Size="Larger" />
            <cc1:SlideShowExtender ID="slideshowextend1" runat="server"

and the code behind is like so

public partial class Accomodations_Default2 : System.Web.UI.Page
    private static DataTable photoSlides = new DataTable();

    protected void Page_Load(object sender, EventArgs e)
        if (this.IsPostBack)
            int AccId = Convert.ToInt32(Request.QueryString.Get("Id"));
            //get the slides for the slideshow from the database
            //start with declaring variables and parameters
            DataTable photoSlides;
            SqlDataReader myReader;
            SqlParameter AccIdParam;
            SqlConnection myCon = new SqlConnection();
            //create connection
            myCon.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            SqlCommand myCommand = new SqlCommand();
            myCommand.CommandText =
                "SELECT ToolTip, Description, PhotoUrl FROM Photo2 WHERE (ExternalId = @ExtId) AND (PhotoType = 'Accomodation')";
            myCommand.CommandType = CommandType.Text;
            myCommand.Connection = myCon;

            AccIdParam = new SqlParameter();
            AccIdParam = new SqlParameter();
            AccIdParam.ParameterName = "@ExtId";
            AccIdParam.SqlDbType = SqlDbType.Int;
            AccIdParam.Size = 32;
            AccIdParam.Direction = ParameterDirection.Input;
            AccIdParam.Value = AccId;


            myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

            photoSlides = new DataTable();

            // set the initial image
            if (photoSlides.Rows.Count > 0)
                imgShowImage.ImageUrl = photoSlides.Rows[0]["PhotoUrl"].ToString();
            GridView1.DataSource = photoSlides;

    public static AjaxControlToolkit.Slide[] GetSlides()
        //AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[3];

        //slides[0] = new AjaxControlToolkit.Slide("../Images/KANO.JPG", "Ascent", "Cool moon night...");
        //slides[1] = new AjaxControlToolkit.Slide("../Images/KANO2.JPG", "Desert", "Red moon desert...");
        //slides[2] = new AjaxControlToolkit.Slide("../Images/KANO3.JPG", "Tulips", "Beautiful tulips...");

        AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[photoSlides.Rows.Count];

        for (int i = 0; i < photoSlides.Rows.Count; i++)
            DataRow dr = photoSlides.Rows[i];
            slides[i] = new AjaxControlToolkit.Slide(
        return slides;
any suggestions?

best regards, Robin

Last edited by robbaralla; March 1st, 2010 at 07:41 PM..
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
AJAX Control Toolkit AutoCompleteExtender ilegend .NET Framework 3.5 0 September 24th, 2008 03:50 AM
AJAX Control Toolkit - AlwaysVisibleControl Extend ilegend .NET Framework 3.5 1 September 24th, 2008 02:14 AM
Save new order of Ajax ReorderList toolkit angshujit ASP.NET 2.0 Basics 0 May 30th, 2008 02:10 AM
How to use Ajax ToolKit on Server for ASP.Net2.0 abhi.sharma05 ASP.NET 2.0 Professional 2 June 18th, 2007 12:07 PM
Choose your ajax toolkit hazemtorab BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 January 1st, 2007 02:47 PM

All times are GMT -4. The time now is 07:11 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.