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?
[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?