i have created a slideshow using the ajax slideshow control. i created it and tested it in a regular .aspx page and it worked fine. but when i went to put it into a master page it doesnt work. when i load the page, it doesnt detect the images. the images
are stored in a file in the solution explorer. i havnt included anything like next buttons because just want the actual slideshow.
To use SlideShow on Masterpage, you need to create webservice as follows:
Add New WebService to you site/project and use following code:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace SchoolManagementWeb
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public AjaxControlToolkit.Slide[] GetSlides()
{
AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[4];
slides[0] = new AjaxControlToolkit.Slide("images/first.gif", "BH", "GB");
slides[1] = new AjaxControlToolkit.Slide("images/last.gif", "Su", "Sn");
slides[2] = new AjaxControlToolkit.Slide("images/edit.gif", "Wr", "W.");
slides[3] = new AjaxControlToolkit.Slide("images/delete.gif", "Wl", "Lr");
return (slides);
}
}
}
i did what you asked and still for some strange reason when i go to load the page my images are not ebing recognised. i have made many time to make sure that the file / path names match and they do. for some reaon it just doesnt seem to recognise them. do
you have any idea why or any adivce on how i can check whats wrong?
young345
Member
201 Points
721 Posts
why doesnt my ajax slideshow work in my master page?
Feb 20, 2009 08:36 PM|LINK
hi,
i have created a slideshow using the ajax slideshow control. i created it and tested it in a regular .aspx page and it worked fine. but when i went to put it into a master page it doesnt work. when i load the page, it doesnt detect the images. the images are stored in a file in the solution explorer. i havnt included anything like next buttons because just want the actual slideshow.
does anybody know why its not working?
i have copied my code underneath.
any advice and help would be great.
thank you
<
body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
<div> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder>
<script runat="Server" type="text/C#"> [System.Web.Services.WebMethod][System.Web.Script.Services.
ScriptMethod] public static AjaxControlToolkit.Slide[] GetSlides(){
AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[4];slides[0] =
new AjaxControlToolkit.Slide("to/oo.jpg", "BH", "GB"); slides[1] = new AjaxControlToolkit.Slide("to/qq.jpg", "Su", "Sn");slides[2] =
new AjaxControlToolkit.Slide("to/ww.jpg", "Wr", "W."); slides[3] = new AjaxControlToolkit.Slide("to/ee.jpg", "Wl", "Lr");
return(slides);}
</script>
<asp:Image ID="Image1" runat="server" Height="100px" Width="100px" /><br />
<cc1:SlideShowExtender ID="SlideShowExtender1" AutoPlay="true" Loop="true" SlideShowServiceMethod="GetSlides" TargetControlID="Image1" runat="server" > </cc1:SlideShowExtender>
</div> </form> </body></
html>chintanpshah
All-Star
19058 Points
3273 Posts
Re: why doesnt my ajax slideshow work in my master page?
Feb 21, 2009 08:53 AM|LINK
To use SlideShow on Masterpage, you need to create webservice as follows:
Add New WebService to you site/project and use following code:
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; namespace SchoolManagementWeb { /// <summary> /// Summary description for WebService1 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class WebService1 : System.Web.Services.WebService { [WebMethod] public AjaxControlToolkit.Slide[] GetSlides() { AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[4]; slides[0] = new AjaxControlToolkit.Slide("images/first.gif", "BH", "GB"); slides[1] = new AjaxControlToolkit.Slide("images/last.gif", "Su", "Sn"); slides[2] = new AjaxControlToolkit.Slide("images/edit.gif", "Wr", "W."); slides[3] = new AjaxControlToolkit.Slide("images/delete.gif", "Wl", "Lr"); return (slides); } } }Modify HTML Markup as:
<asp:Image ID="Image1" runat="server" Height="100px" Width="100px" /><br />
<cc1:SlideShowExtender ID="SlideShowExtender1" AutoPlay="true" Loop="true" SlideShowServiceMethod="GetSlides" SlideShowServicePath="WebService1.asmx"
TargetControlID="Image1" runat="server">
</cc1:SlideShowExtender>
(Added SlideShowServicePath="WebService1.asmx", replace it with your webservice path)
Hope this helps...
My Software Website
young345
Member
201 Points
721 Posts
Re: why doesnt my ajax slideshow work in my master page?
Feb 21, 2009 10:41 AM|LINK
thanks for your help,
i did what you asked and still for some strange reason when i go to load the page my images are not ebing recognised. i have made many time to make sure that the file / path names match and they do. for some reaon it just doesnt seem to recognise them. do you have any idea why or any adivce on how i can check whats wrong?
thank you, much appreciated