This is a migrated thread and some comments may be shown as answers.

Webservice only called once

2 Answers 86 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 10 Oct 2014, 09:26 PM
I need to create a rotator that dynamically adds and removes items, because the items will be changing in real time. I was trying to get the web service to work, and it does work the first time, but it never gets called a second time. Here is my code:

[code language="csharp"]
[System.Web.Script.Services.ScriptService]
public class OverstockService : System.Web.Services.WebService 
{
    [WebMethod]
public RadRotatorItemData[] RSGetImages(int itemIndex, string argument)
{
List<RadRotatorItemData> result = new List<RadRotatorItemData>();
RadRotatorItemData item; 
for (int i = 0; i < 3; i++)
{
item = new RadRotatorItemData();
item.Html = "test "+(itemIndex+i) + "arg=" + argument;
result.Add(item);
}
return result.ToArray();
}
}
[/code]

[code language="html"]
<script type="text/javascript">
var index = 0;
function OnClientItemsRequesting(sender, args) {
var dbg = document.getElementById("debug");
dbg.innerHTML += "Request<br/>";
args.set_argument(index.toString());
index++;
}

</script>
<span id="debug"></span>
<telerik:RadRotator ID="rrGallery" runat="server" Width="250px" Height="250px" ScrollDuration="500" 
ItemHeight="200" ItemWidth="200" OnClientItemsRequesting="OnClientItemsRequesting" RotatorType="AutomaticAdvance">
<WebServiceSettings Path="/WebServices/OverstockService.asmx" Method="RSGetImages" />
</telerik:RadRotator>

[/code]

My plan was to remove items from the list once it got to a certain size, but the web service only gets called once. Can anyone help please?


2 Answers, 1 is accepted

Sort by
0
Shawn
Top achievements
Rank 1
answered on 10 Oct 2014, 09:27 PM
Also, how do you post code to this forum? Can't find that info anywhere.
0
Shawn
Top achievements
Rank 1
answered on 13 Oct 2014, 12:51 PM
Ok, I figured it out. I had to set WrapFrames="false".
Tags
Rotator
Asked by
Shawn
Top achievements
Rank 1
Answers by
Shawn
Top achievements
Rank 1
Share this question
or