Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Tuesday, September 25, 2007

Building an AJAX Slide Show in ASP.net

This was almost simple, but then the image paths made plug and chug necessary until the path problem was resolved. The key is to use image paths in the web service without ~/ and without /. Instead just type the directory name and the file name.



using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;


/// <summary>
/// Summary description for WebServiceSlideShow
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService()]
public class WebServiceSlideShow : System.Web.Services.WebService {

public WebServiceSlideShow () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public AjaxControlToolkit.Slide[] GetSlides() {
AjaxControlToolkit.Slide[] slides;
System.Collections.ArrayList alSlideUrls = new ArrayList();
alSlideUrls.Add("_imgLibrary/photo1.jpg");
alSlideUrls.Add("_imgLibrary/photo2.jpg");
alSlideUrls.Add("_imgLibrary/photo3.jpg");
slides = new AjaxControlToolkit.Slide[alSlideUrls.Count];
int i = 0;
foreach (string str in alSlideUrls)
{
slides[i] = new AjaxControlToolkit.Slide(str, str, str);
i++;
}
return slides;
}
}

Here is the ASPX code:


<div style="text-align: center">
<table style="vertical-align: text-top">
<tr>
<td style="width: 278px" nowrap="noWrap" align="center">
<asp:Image ID="ImagePlayer" runat="server" />
</td>
</tr>
<tr>
<td nowrap="nowrap" style="width: 278px" align="center">
<asp:Button ID="btnBack" runat="server" Text="Back" />
<asp:Button ID="btnPlay" runat="server" Text="Play" />
<asp:Button ID="btnNext" runat="server" Text="Next" />&nbsp;
</td>
</tr>
</table>
</div>
<cc1:SlideShowExtender ID="SlideShowExtender1" runat="server" TargetControlID="ImagePlayer" AutoPlay="True" Loop="True" NextButtonID="btnNext" PlayButtonID="btnPlay" PlayButtonText="Play" PreviousButtonID="btnBack" SlideShowServiceMethod="GetSlides" SlideShowServicePath="WebServiceSlideShow.asmx" StopButtonText="Pause">
</cc1:SlideShowExtender>

8 comments:

Anonymous said...

Thanks Mate - appreciate your note about the image paths - saved me much time!

Anonymous said...

горячие порно видео
жесткая порнуха бесплатно
korean porno
брат трахает систру
фото приколы порно
писька бритая фото
секс символ росии
скачка порно видео
часные порно сайты
порно ролики толстушки

Anonymous said...

web sites websites
[url=http://cysevcu.verausgabt.de/79/index.html]script to email 775[/url]
[url=http://cuukvcj.troesten.de/37/index.html]extractor pro email g[/url]
[url=http://czsoeps.demonstrativ.de/map.html]internet download accelerator map 42[/url]
[url=http://ctajhmx.xn--gewhnt-yxa.de/33/index.html]address email 129 i[/url]
[url=http://cysevcu.verausgabt.de/45/index.html]encryption hipaa email Q[/url]
[url=http://cuzldhs.de.pl/72/map.html]microsoft outlook free map w[/url]
[url=http://czsoeps.demonstrativ.de/58/map.html]senator santorum rick x[/url]

Good luck

Anonymous said...

[url=http://www.pinskerdream.com/bloghoster/?u=videosealisha5]AAA Media Player[/url] [url=http://www.adulthostedblogs.com/?u=videoseambrose5]AVI DivX to DVD SVCD VCD Converter 2.2.2[/url]
A-Z Video Converter Ultimate 7.85 Easy DVD CD Burner 3.0.97
http://www.adulthostedblogs.com/?u=videosealexa6 Digeus Online TV Player
[url=http://lecturer.elektrounesa.org/?u=videoseallyn8]Tanbee iPod Converter[/url] [url=http://www.blogportalen.no/blog/?u=videoseacacia3]BSplayer Pro 2.26[/url]
Speed Video Splitter PPT To Video Scout 1.5
http://citizenblogs.com/?u=videoseantony7 ImTOO Video and Audio Suite 3.1.47.1123
Video to Audio Cutter 2.00
my icq:858499940385

Anonymous said...

It agree, it is the remarkable information

Anonymous said...

Bravo, excellent phrase and is duly

Anonymous said...

I apologise, but, in my opinion, you are not right. I can defend the position.

Anonymous said...

Wow! In the end I got a website from where I can actually get valuable data concerning my study and knowledge.


Here is my weblog ... econoo.com (http://votre-tache.com)