ASP.NET - ajax slideshow calling webservice with parameter

Asked By Andy Kalbvleesch
17-Aug-09 01:13 PM

I want to use the ajax slideshow extender and got so far to use it with calling a range of images from database by coding an ID hard in the webservice. However I want to be able to pass a parameter to tthe webservice so I can get specific images. Code is below... Anybody ?

Code in aspx:

            <ajaxToolkit:SlideShowExtender ID="slideshowextend1" runat="server"
                TargetControlID="Image1"
                SlideShowServicePath="slidesservice.asmx"
                SlideShowServiceMethod="GetSlides"
                AutoPlay="true"
                ImageDescriptionLabelID="imageLabel1"
                NextButtonID="nextButton"
                PlayButtonText="Play"
                StopButtonText="Stop"
                PreviousButtonID="prevButton"
                PlayButtonID="playButton" />

 

Webservice:
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<System.Web.Script.Services.ScriptService()> _
Public Class SlidesService
    Inherits System.Web.Services.WebService

    <WebMethod()> _
   Public Function GetSlides() As AjaxControlToolkit.Slide()
        Dim ds As System.Web.UI.WebControls.SqlDataSource = New SqlDataSource()
        ds.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("apuraprovider")
        Dim mySelect As String
        Dim count As Integer = 0
        mySelect = "SELECT objectenfotos.object_ID, objecten.klant_ID, objectenfotos.fotonaam, objectenfotos.omschrijving " & _
        "FROM objectenfotos INNER JOIN objecten ON objectenfotos.object_ID = objecten.object_ID " & _
        "where objecten.klant_ID = myparameter

        ds.SelectCommand = mySelect
        Dim dv As System.Data.DataView = DirectCast(ds.[Select](New DataSourceSelectArguments()), System.Data.DataView)
        count = dv.Table.Rows.Count
        Dim slides As AjaxControlToolkit.Slide() = New AjaxControlToolkit.Slide(count - 1) {}
        Try
            For i As Integer = 0 To count - 1
                slides(i) = New AjaxControlToolkit.Slide("uploadlogos/mid/" & dv.Table.Rows(i)("fotonaam").ToString(), dv.Table.Rows(i)("fotonaam").ToString(), dv.Table.Rows(i)("omschrijving").ToString())
            Next
        Catch
            'some errorhandling
        End Try
        Return (slides)
    End Function

End Class

 

 

 

 

Use the ContextKey to pass arguments to the webservice. It is a two-step process.  Use the ContextKey to pass arguments to the webservice. It is a two-step process.

17-Aug-09 02:16 PM
Step 1: add the UseContextKey and the ContextKey attributes.
<ajaxToolkit:SlideShowExtender ID="slideshowextend1" runat="server" 
                TargetControlID="Image1" 
                SlideShowServicePath="slidesservice.asmx"
                SlideShowServiceMethod="GetSlides" 
                AutoPlay="true" 
                ImageDescriptionLabelID="imageLabel1"
                NextButtonID="nextButton" 
                PlayButtonText="Play" 
                StopButtonText="Stop"
                PreviousButtonID="prevButton" 
                PlayButtonID="playButton"
UseContextKey="true" ContextKey="parametervalue"/>

Step 2: modify the function like this.
.....
<WebMethod()> _
   Public Function GetSlides(ByVal contextKey As String) As AjaxControlToolkit.Slide()
        Dim ds As System.Web.UI.WebControls.SqlDataSource = New SqlDataSource()
        ds.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("apuraprovider")
        Dim mySelect As String
        Dim count As Integer = 0
        mySelect = "SELECT objectenfotos.object_ID, objecten.klant_ID, objectenfotos.fotonaam, objectenfotos.omschrijving " & _
        "FROM objectenfotos INNER JOIN objecten ON objectenfotos.object_ID = objecten.object_ID " & _
        "where objecten.klant_ID = 
myparameter
         where objecten.klant_ID = contextKey
......

ajax slideshow  ajax slideshow

18-Aug-09 01:00 AM
For a lightweight option to run a AJAX slideshow, consider using a jQuery slideshow plugin like Cycle along with a Generic HTTP Handler (.ashx) -
http://jonraasch.com/blog/a-simple-jquery-slideshow
http://www.eggheadcafe.com/tutorials/aspnet/b8381915-06d9-4538-b4bb-5ac2a8e73f34/implementing-continuous-s.aspx
Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B stop a long running thread? (A) How do I debug thread? (A) What is Thread.Join () in threading? (A) What are Daemon threads and how can a thread be created as services? (B) Which attribute is used in order that the method can be used as WebService? (A) What are the steps to create a web service and consume it? (A) Do webservice have state? Chapter 5: Caching Concepts (B) What is an application object? (I) what is A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP
in Sql server as var_name int How do you separate business logic while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this we have to edit the page level debugging The control itself will take care of the date display How can you deploy an asp.net application ? You can deploy an ASP.NET Web application using any one of the following three deployment options. a) Deployment using VS
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much different from unstrucured ASP and there is no correct way to
Tracing in ASP.NET? hi all, what is tracing? how to achieve tracing in asp.net? different ways of doing tracing? thanks and regards Aman Khan hi. . Tracing in ASP.NET 2.0 Tracing is a way to monitor the execution of your ASP.NET application. You can record exception details and program flow in a way that doesn't
session is user based mean u can differentiate login user in different way • Process independent. ASP.NET session state is able to run in a separate process from the ASP.NET host process. If session state is in a separate process, the ASP.NET process can come and go while the session state process remains available. Of course, you ASP, too. • Support for server farm configurations. By moving to an out-of-process model, ASP.NET also solves the server farm problem. The new out-of-process model allows all servers