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

Invalid web service call missing parameter

2 Answers 315 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Johnny Smith
Top achievements
Rank 1
Johnny Smith asked on 11 May 2012, 03:27 PM

Thanks in advance for any help.
 
I used the telerik sample http://demos.telerik.com/aspnet-ajax/tooltip/examples/radtooltipmanagerclientapi/defaultcs.aspx as a basis for this code.   Running the sample on my local Windows 7 machine works but fails in my local dev application.  "Invalid web service call missing parameter" error occurs when calling tooltip.set_value()

var sServiceTrack = oGrid.get_masterTableView().get_dataItems()[sRowIndex].get_dataItem()["service_track_event_id"];
var sPeople = oGrid.get_masterTableView().get_dataItems()[sRowIndex].get_dataItem()["people_id"];
var sParms = sServiceTrack + "~" + sPeople;
//must be a client
if (sServiceTrack == null || sServiceTrack == "")
    return;
var tooltipManager = $find("<%= objRadToolTipManagerClient.ClientID %>");
//If the user hovers the image before the page has loaded, there is no manager created
if (!tooltipManager) 
    return;
//Find the tooltip for this element if it has been created 
var tooltip = tooltipManager.getToolTipByElement(element);
//Create a tooltip if no tooltip exists for such element 
if (!tooltip)
{
    tooltip = tooltipManager.createToolTip(element);
    tooltip.set_value(sParms);
}
//Let the tooltip's own show mechanism take over from here - execute the onmouseover just once
element.onmouseover = null;
//show the tooltip
tooltip.show();

ASPX

 

<telerik:RadToolTipManager ID="objRadToolTipManagerClient" Width="300" Height="100"
    OffsetY="-1" HideEvent="Default" runat="server" EnableShadow="true" RelativeTo="Element"
    Position="MiddleRight" ShowEvent="OnMouseOver" EnableViewState="false" 
    IgnoreAltAttribute="true" >
    <WebServiceSettings Path="wsToolTips.asmx" Method="GetClientToolTipSingelParm" />
</telerik:RadToolTipManager>

Web service

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
  
using System.Configuration;
using System.Web.Script.Services;
using System.Data;
using System.Web.UI;
using System.IO;
using System.Reflection;
  
namespace EvolvCS
{
    [WebService(Namespace = "http://defran.com/webservices")]
    [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 wsToolTips : System.Web.Services.WebService
    {
        [WebMethod]
        [System.Web.Script.Services.ScriptMethod]
        public string GetClientToolTipSingelParm(string sValues)
        {
            string[] aValues = sValues.Split('~');
            string serviceTrackId = aValues[0];
            string peopleId = aValues[1];
  
            return ViewManager.RenderClientToolTip(serviceTrackId, peopleId);
        }
  
    }
  
    public class ViewManager
    {
        public static string RenderClientToolTip(string strServiceTrackId, string strPeopleId)
        {
            Page pageHolder = new Page();
            client_header_multi viewControl = (client_header_multi)pageHolder.LoadControl("client_header_multi.ascx");
            viewControl.serviceTrack = strServiceTrackId;
            viewControl.people_id = strPeopleId;
  
            pageHolder.Controls.Add(viewControl);
  
            StringWriter output = new StringWriter();
            HttpContext.Current.Server.Execute(pageHolder, output, false);
  
            return output.ToString();
        }
    }
}

 

2 Answers, 1 is accepted

Sort by
0
Johnny Smith
Top achievements
Rank 1
answered on 11 May 2012, 04:23 PM
Found the problem and fixed it but this is rather strange.  A parameter in the web service method MUST be named 'context' otherwise it won't work.  Here is what worked:  Can someone document this?
[WebMethod(EnableSession=true, Description="Gets client tooltip HTML")]
[System.Web.Script.Services.ScriptMethod]
public string GetClientToolTipSingelParm(object context)
{
    IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context;
    string sValues = ((string)contextDictionary["Value"]);
0
Marin Bratanov
Telerik team
answered on 15 May 2012, 03:46 PM
Hello Johnny,

I am glad to hear you have managed to resolve the situation.

The signature of the webservice is exposed in several places and they all include the parameter with the name set to context. This variable is actually parameter used in the RadToolTipManager's code when passing/reading/loading the data and thus it should stay with the same name. WebService loading is done almost without any code from the developer - all this code resides in the RadToolTipManager's source code and unfortunately, for this case, you cannot optionally name it because in the source code the object must have a name and we have chosen context.

All that being said - I will update the resources to emphasize the need to keep the parameter name to "context" and it will be live with our next upload for the Q2 release.



Kind regards,
Marin
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
ToolTip
Asked by
Johnny Smith
Top achievements
Rank 1
Answers by
Johnny Smith
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or