Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Sir,
I have used following code,but I have occurred an error like "source code not available" & also "-- C:\Users\Stephen\Documents\Repos\Superexpert\AjaxControlToolkit\Server\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs " this error.
 
The code as follow.
 
Page source code..
 
</p>
        <asp:Image ID="Image1" runat="server" Height="107px"    Width="133px" />
         <asp:ScriptManager ID="ScriptManager" runat="server">
        </asp:ScriptManager>
         <asp:Image ID="Image2" runat="server" Height="122px"   Width="127px" />
         <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
         <br />
    <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:SlideShowExtender ID="Slideshowextender" runat="server" PreviousButtonID="Button1"
    NextButtonID="Button3" PlayButtonID="Button2" TargetControlID="Image1"
    SlideShowServiceMethod="GetImage "   PlayInterval="5000" PlayButtonText="Play"
        StopButtonText="Stop" UseContextKey="True"></asp:SlideShowExtender>
 
    <br />
</p>

*** .cs code****
 private static DataTable tblData = new DataTable();
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=Nildemo;User ID=sa;Password=2008");
        conn.Open();
        SqlCommand cmd = new SqlCommand("SELECT ID,ImageName,Image FROM Pic", conn);
        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
        tblData = new DataTable();
        adapter.Fill(tblData);
        Slideshowextender.SlideShowServiceMethod = "Handler.ashx?ID =" + Request.QueryString["ID"];
 
        if (tblData.Rows.Count > 0)
        {
            Image1.ImageUrl = tblData.Rows[0]["Image"].ToString();
      
        }
}
[System.Web.Services.WebMethod]
   [System.Web.Script.Services.ScriptMethod]
   public static AjaxControlToolkit.Slide[] GetImage()
   {
       AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[tblData.Rows.Count];
       for (int i = 0; i < tblData.Rows.Count; i++)
       {
           DataRow dr = tblData.Rows[i];
           slides[i] = new AjaxControlToolkit.Slide();
       }
       return slides;
 
   }
 
**** use handalar *****
<%@ WebHandler Language="C#" Class="Handler" %>
 
using System;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.IO;
using System.Collections.Specialized;
 
public class Handler : IHttpHandler {
public void ProcessRequest(HttpContext context)
{
    string id = context.Request.QueryString["ID"]; //get the querystring value that was pass on the ImageURL
    if (id != null)
    {
 
        MemoryStream memoryStream = new MemoryStream();
        SqlConnection conn = new SqlConnection("Data Source=KSCPL-PC;Initial Catalog=Nildemo;User ID=sa;Password=2008");
        string sql = "SELECT * FROM Pic WHERE ID = @ID";
 
        SqlCommand cmd = new SqlCommand(sql, conn);
        cmd.Parameters.AddWithValue("@ID", id);
        conn.Open();
 
        SqlDataReader reader = cmd.ExecuteReader();
        reader.Read();
 
        //Get Image Data
        byte[] file = (byte[])reader["Image"];
 
        reader.Close();
        conn.Close();
        memoryStream.Write(file, 0, file.Length);
        context.Response.Buffer = true;
        context.Response.BinaryWrite(file);
        memoryStream.Dispose();
 
    }
}
 
public bool IsReusable
{
    get
    {
        return false;
    }
}
}
Posted 7-Jan-13 18:44pm
Edited 7-Jan-13 19:26pm
v2
Comments
VishwaKL at 9-Jan-13 20:54pm
   
http://technico.qnownow.com/ajax-slide-show-extender-control-in-asp-net/
 

check this it amy help you
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Slide show using ajax control[^]
 

 
public static AjaxControlToolkit.Slide[] RetrieveSlides()
{
}
 

 
In this method call your database method.
 

 
Check this it may help you
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

    [System.Web.Services.WebMethodAttribute()]
    [System.Web.Script.Services.ScriptMethodAttribute()]
 
    public static AjaxControlToolkit.Slide[] GetSlides()
    {
        AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[tblData.Rows.Count];
 
        for (int i = 0; i < tblData.Rows.Count; i++)
        {
            slides[i] = new AjaxControlToolkit.Slide("Handler.ashx?ID=" + ID, "test", "test");
        }
 
        return slides;
    }
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 449
1 Maciej Los 274
2 CPallini 160
3 Sergey Alexandrovich Kryukov 152
4 Richard MacCutchan 130
0 OriginalGriff 5,474
1 Sergey Alexandrovich Kryukov 4,713
2 Peter Leow 2,944
3 DamithSL 2,465
4 Maciej Los 2,434


Advertise | Privacy | Mobile
Web02 | 2.8.140718.1 | Last Updated 8 Jan 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid