0

I have a Telerik RadToolTipManager in which I call a webservice method like this:

<asp:LinkButton ID="link"  runat="server" >
    <%# DataBinder.Eval(Container.DataItem, "Name")%>
</asp:LinkButton>
<telerik:RadToolTipManager ID= "tooltip"   runat="server" width="400px"
    RelativeTo="Element" HideEvent="LeaveTargetAndToolTip"
    Animation="Slide" EnableTheming="true" ShowEvent="OnMouseOver">
    <WebServiceSettings Method="GetToolTipData" Path="DropdownWebService.asmx"
    UseHttpGet="true" />
    <TargetControls>
        <telerik:ToolTipTargetControl TargetControlID="link">
        </telerik:ToolTipTargetControl>
    </TargetControls>
</telerik:RadToolTipManager> 

and in my web service code behind I have this:

[WebMethod(EnableSession = true)]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public string GetToolTipData(object context)
{
    IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context;
    string tooltipValue = ((string)contextDictionary["Value"]);
    string targetID = ((string)contextDictionary["TargetControlID"]);
    string str = "";
    return tooltipValue ;
}

It works fine and it shows the tooltip but in the variable tooltipValue I am only getting an empty string. I want the value of tooltip, is there any other way around?

1 Answer 1

1

That's because the link target has no Value associated with it. Add one:

 <telerik:RadToolTipManager ID= "tooltip"   runat="server" width="400px"
   RelativeTo="Element" HideEvent="LeaveTargetAndToolTip"
   Animation="Slide" EnableTheming="true" ShowEvent="OnMouseOver">
   <WebServiceSettings Method="GetToolTipData" Path="DropdownWebService.asmx"
    UseHttpGet="true" />
   <TargetControls>
    <telerik:ToolTipTargetControl TargetControlID="link" Value="someValue"></telerik:ToolTipTargetControl>
   </TargetControls>
  </telerik:RadToolTipManager> 

Also, make sure that this is not happening in every row in your grid...Add one tooltip manager to the page and use the ItemDataBound event to add targets in the code-behind. Take a look here: http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=tooltip.

Sign up to request clarification or add additional context in comments.

2 Comments

My scenario is different of placing radtooltip in it I have a repeater control and I want to bind value dynamically some thing like this <telerik:ToolTipTargetControl TargetControlID="link" Value='<%# DataBinder.Eval(Container.DataItem, "Name")%>'></telerik:ToolTipTargetControl> but its not working
Of course it won't. Have one manager OUTSIDE of the repeater. Add targets when items are databound in the code-behind. See this demo's code: demos.telerik.com/aspnet-ajax/tooltip/examples/…. It uses a gridview, but that's irrelevant. Also, another option is to use data attributes (or other custom attributes for the targets) and create tooltips with JavaScript, so you can get that custom value and use it as shown here: demos.telerik.com/aspnet-ajax/tooltip/examples/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.