Wednesday, March 28, 2012

Dynamic Ajax SlideShow Extender with ContextKey...help

Does anyone have an example of how to use the slideshow extender dynamically?

I've tried copying the process used by the AutoCompletewithContextKey but when I try to set the contextkey I get the following error when the page loads ;

"Object does not support this property or method"

Where can I get a list of the properties/methods supported on the java side of things...I've tried the object browser?

Here's my default.aspx :

<%@dotnet.itags.org.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<linkhref="Basic.css"rel="stylesheet"type="text/css"/>

<title>Niamh Ella Land</title>

</head>

<body>

<formid="form1"runat="server">

<asp:ButtonID="prevButton"runat="Server"

Style="z-index: 100; left: 468px; position: absolute; top: 335px;"Width="60px"Font-Size="Larger"Text="Prev"Font-Underline="True"/>

<asp:ButtonID="playButton"runat="Server"

Style="z-index: 101; left: 528px; position: absolute; top: 335px;"Width="60px"Font-Size="Larger"Text="Play"Font-Underline="True"/>

<asp:ButtonID="nextButton"runat="Server"

Style="z-index: 102; left: 588px; position: absolute; top: 335px;"Width="60px"Font-Size="Larger"Text="Next"Font-Underline="True"/>

<asp:LabelID="imageLabel1"runat="Server"

Style="z-index: 103; left: 519px; position: absolute; top: 308px;"Font-Underline="True"/>

<asp:LabelID="Label1"runat="server"Font-Names="Times New Roman"Font-Size="Larger"

Style="z-index: 104; left: 484px; position: absolute; top: 35px"Text="Niamh Ella Land"

Width="136px"Font-Underline="True"></asp:Label>

<asp:ImageID="Image1"runat="server"

Height="220px"

Style="border: 1px solid black;width:auto; z-index: 105; left: 404px; position: absolute; top: 73px;"

ImageUrl="~/images/Album5/HPIM1604.JPG"

AlternateText="Sharky : In the big bed ocean"Width="261px"BorderStyle="Groove"/>

<ajaxToolkit:SlideShowExtenderrunat="server"ID="slideshowextend1"

ImageDescriptionLabelID="imageLabel1"

BehaviorID="grazzer"

UseContextKey="true"

ContextKey="images\Album3"

Loop="True"

NextButtonID="nextButton"

PlayButtonID="playButton"

PlayButtonText="Play"

PreviousButtonID="prevButton"

SlideShowServiceMethod="GetSlides"

SlideShowServicePath="SlidesService.asmx"

StopButtonText="Stop"

TargetControlID="Image1"AutoPlay="True"/>

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

<asp:DropDownListID="DropDownList1"runat="server"DataSourceID="XmlDataSource1"

DataTextField="text"DataValueField="path"Style="z-index: 107; left: 77px;

position: absolute; top: 151px"Width="199px">

</asp:DropDownList>

<asp:XmlDataSourceID="XmlDataSource1"runat="server"DataFile="~/AlbumList.xml"></asp:XmlDataSource>

<scripttype="text/javascript">

// Hook up to the AutoComplete populating/populated events

function pageLoad() {

var SlideShow = $find('grazzer');

if (!SlideShow)return;

//var userContext = $get('DropDownList1');

//if (!userContext) return;

//alert(userContext.DataValueField.text);

// Dynamically assign the context and change the color when processing

SlideShow.add_populating(function()

{

SlideShow.set_contextKey("images\Album1");

});

}

</script>

</form>

</body>

</html>

Here's my webservice which works :

Imports System.Web

Imports System.Web.Services

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()> _

PublicClass SlidesServiceInherits System.Web.Services.WebService

<WebMethod()> _

PublicFunction GetSlides()As AjaxControlToolkit.Slide()

Dim targetDirectoryAsString ="images/Album5"

Dim dAs IO.DirectoryInfo =New IO.DirectoryInfo(Server.MapPath(targetDirectory))

Dim fileEntries()As IO.FileInfo = d.GetFiles("*.jpg")

Dim filecount = 0

Dim fileNameAs IO.FileInfo

Dim MySlides(fileEntries.Length - 1)As AjaxControlToolkit.Slide

ForEach fileNameIn fileEntries

MySlides(filecount) =New AjaxControlToolkit.Slide(targetDirectory &"/" & fileName.Name.ToString, fileName.Name.ToString, fileName.Name.ToString)

filecount = filecount + 1

Next fileName

Return MySlides

EndFunction

<WebMethod()> _

PublicFunction GetSlidesWithContext(ByVal ContextKeyAsString)As AjaxControlToolkit.Slide()

Dim targetDirectoryAsString ="images/Album5"

If ContextKey =""Then

ContextKey = targetDirectory

EndIf

Dim dAs IO.DirectoryInfo =New IO.DirectoryInfo(Server.MapPath(ContextKey))

Dim fileEntries()As IO.FileInfo = d.GetFiles("*.jpg")

Dim filecount = 0

Dim fileNameAs IO.FileInfo

Dim MySlides(fileEntries.Length - 1)As AjaxControlToolkit.Slide

ForEach fileNameIn fileEntries

MySlides(filecount) =New AjaxControlToolkit.Slide(ContextKey &"/" & fileName.Name.ToString, fileName.Name.ToString, fileName.Name.ToString)

filecount = filecount + 1

Next fileName

Return MySlides

EndFunction

End Class

Frustrated Newbie,

Graham.

Could you escape the backslash and retry?

"images\Album1" => "images\\Album1"


Thanks for the suggestion, yes I've already tried this to no avail.

the webpage complains about the method I'm trying to use...

How can I see what methods I should be able to use?


Hi,

I've also verified that I'm running the latest toolkit version 10920.

Does anyone have a working example of using and setting the contextkey in the AJAX SlideShow Extension?

Am I wasting time on something that isn't actually possible? Any documemtation?

Thank you,

Graham.


Take a look athttp://www.codeplex.com/AtlasControlToolkit/SourceControl/FileView.aspx?itemId=352171&changeSetId=27216. You will find a lot of useful Toolkit control usage in the aspx files of the TestingClient and ToolkitTests projects.


Thank you, that's just what I was looking for..great examples!


Crying

I got the error like this:

'AjaxControlToolkit.SlideShowExtender' does not contain a definition for 'ContextKey' when I used Mr.Wen's code.Any idea???

this.slideshowextend1.ContextKey = Request.QueryString["qs"];


Have you updated to the latest version of the toolkit. I had a similar problem, deleted all my binaries and loaded the latest and everything worked!!!

No comments:

Post a Comment