Answered by:
My slideshowextender is not changing the images what should i do

Question
-
User1548747448 posted
I have a dynamic slide show on my website but it is not changing the images plzz help
my code for html::
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Garba_competition.aspx.cs" Inherits="spandan.Garba_competition" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Image ID="Image1" runat="server" />
<asp:SlideShowExtender ID="Slideshowextender1" runat="server"
Loop="true"
PreviousButtonID="prevButton"
AutoPlay="true"
SlideShowServiceMethod="GetSlides"
NextButtonID="nextButton"
PlayButtonID="playButton"
TargetControlID="Image1"
PlayButtonText="Play"
StopButtonText="Stop"
UseContextKey="True" /><asp:Button runat="Server" ID="prevButton" Text="Prev" Font-Size="Medium" />
<asp:Button runat="Server" ID="playButton" Text="Play" Font-Size="Medium" />
<asp:Button runat="Server" ID="nextButton" Text="Next" Font-Size="Medium" /></asp:Content>
and code for aspx.cs page::
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
using System.Data;
using System.Data.SqlClient;namespace spandan
{
public partial class Garba_competition : System.Web.UI.Page
{
DataConnect obj
= new DataConnect();protected void Page_Load(object sender, EventArgs e)
{
loadslide();
}
protected void loadslide()
{
string q = "SELECT * FROM Image_master";
DataSet ds2;
ds2 = new DataSet();
ds2 = obj.LoadData(q);
if (ds2.Tables[0].Rows.Count > 0)
{
AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[ds2.Tables[0].Rows.Count];for (int i = 0; i < ds2.Tables[0].Rows.Count ; i++)
{
DataRow dr = ds2.Tables[0].Rows[i];
slides[i] = new AjaxControlToolkit.Slide();// SlideShowExtender.SlideShowServiceMethod="Getslides(Convert.ToString(i))";
if (ds2.Tables[0].Rows.Count > 0 )
{
Image1.ImageUrl = ds2.Tables[0].Rows[i]["Image_url"].ToString();
}
}//SlideShowExtender1.slides() = ds2.Tables[0];
// SlideShowExtender1.DataBind();}
}
}
}Friday, February 5, 2016 12:56 PM
Answers
-
User-986267747 posted
Hi pooja1991,
SlideShowServiceMethod="GetSlides"According to your code, i don't find the webservice method called GetSlides, i suggest that you'd better learn how to use with the Microsoft AJAX Control toolkit.
http://www.c-sharpcorner.com/uploadfile/prathore/ajax-slideshowextender-control/
Best Regards,
Klein zhang
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, February 8, 2016 5:34 AM
All replies
-
User-718146471 posted
Hi Pooja, what I would suggest is instead of using a data set with a for loop, change it to a SQL Data Reader and a while loop. Let me know if you need help wiring that up.
Friday, February 5, 2016 1:53 PM -
User-986267747 posted
Hi pooja1991,
SlideShowServiceMethod="GetSlides"According to your code, i don't find the webservice method called GetSlides, i suggest that you'd better learn how to use with the Microsoft AJAX Control toolkit.
http://www.c-sharpcorner.com/uploadfile/prathore/ajax-slideshowextender-control/
Best Regards,
Klein zhang
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, February 8, 2016 5:34 AM