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

Load on Demand - Missing value for parameter

3 Answers 146 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 22 Dec 2011, 06:11 PM
In this project we have a rotator that should load items as needed, so we created a web service to do just that. In your example, you use a WCF web-service. After trying that unsuccessfully we switched over and tried creating an asmx web service. We are getting the following error:

RadRotator items request failed:
Exception = Invalid web service call, missing value for parameter: 'index'.

Any assistance in getting past this would be great! 

Here is the code for the rotator:

<telerik:RadRotator ID="ItemRotator" runat="server" Width="100%" Height="500px" CssClass="horizontalRotator"
    ScrollDuration="500" FrameDuration="1" ItemHeight="200" ItemWidth="230" RotatorType="ButtonsOver"
    WrapFrames="false"  >
      <WebServiceSettings Path="~/Services/Assessment.asmx" Method="LoadAssessmentItemThumbnails"/>
</telerik:RadRotator>

And the web service:


using System;
using System.Collections.Generic;
using System.Web.Services;
using Telerik.Web.UI;
using Thinkgate.Base.Classes;
 
namespace Thinkgate.Services
{
    /// <summary>
    /// Summary description for Assessment1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.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 Assessment1 : System.Web.Services.WebService
    {
        [WebMethod(true)]
        [System.Web.Script.Services.ScriptMethod]
        public RadRotatorItemData[] LoadAssessmentItemThumbnails(int index = 0, string argument = "")
        {
            List<RadRotatorItemData> result = new List<RadRotatorItemData>();
 
            List<AssessmentItem> itemList = AssessmentItem.GetIncrementedAssessmentItemsByGradeSubjectCourse("01", "Mathematics", "Mathematics", index, index + 10);
 
            foreach (AssessmentItem item in itemList)
            {
                var rotatorItemData = new RadRotatorItemData();
 
                rotatorItemData.Html = @"<div style='position: relative; background-color: green'>"
                                     + @"<input style='position: absolute; top: 0px' type='checkbox'/>"
                                     + @"<img style='position: absolute; top: 0px; left: 30px;' "
                                     + @"src='/Thumbnails/thumb_item_" + item.ID + ".png' "
                                     + @"alt='Item Thumbnail' onerror='onImgError(this);' onLoad='setDefaultImage(this);' /></div>";
 
                result.Add(rotatorItemData);
            }
 
            return result.ToArray();
 
        }
    }
}


If we need to switch back to an svc web service please help us to set this up in the web.config as that was also an issue. 

In addition, can the html be loaded into rad docks on item data bound?


Thanks in advance,
Steven

3 Answers, 1 is accepted

Sort by
0
Steven
Top achievements
Rank 1
answered on 22 Dec 2011, 09:56 PM
Solved it. It wasn't an AJAX enabled web service. :)
0
Johnny Smith
Top achievements
Rank 1
answered on 10 May 2012, 11:00 PM
@Steven
Looking at your code it looks like your web service was already AJAX enabled.  I have the same problem.  What precisely did you do?
Thanks
-Johnny
0
Slav
Telerik team
answered on 15 May 2012, 12:35 PM
Hello Johnny,

The parameters of the web service method should be named as shown in the online demo Rotator / Load On Demand in order to implement the load on demand functionality. In your case it appears that you have used index instead of itemIndex and the passed parameter is not recognized.

To resolve the issue, please use the following signature for the web service method:
public RadRotatorItemData[] LoadAssessmentItemThumbnails(int itemIndex, string argument)
{
...
}

Regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Rotator
Asked by
Steven
Top achievements
Rank 1
Answers by
Steven
Top achievements
Rank 1
Johnny Smith
Top achievements
Rank 1
Slav
Telerik team
Share this question
or