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

Tooltip shown incorrectly when set target to grid row element

2 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
TIGER
Top achievements
Rank 1
TIGER asked on 04 Nov 2011, 03:33 AM
Hi,
  I have a grid in which I wanted to have a tooltip with some text and a picture shown to the bottom of the row when the row is clicked. I tried to get the row element from client side javascript as follows:
            function rowClicked(sender, args) {
                var plu = args.getDataKeyValue("PLUCODE")
                var pline = args.getDataKeyValue("PLINE")
                var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                var id = args.get_gridDataItem().get_element().id;
                masterTable.fireCommand("ShowDetail", plu + "|" + pline+"|"+id);
}
this row element id was something like"RadGrid1_ctl00__1" and was passed to the server side and then the tooltip TargetControlID got set as following:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "ShowDetail")
    {
        string[] s = e.CommandArgument.ToString().Split('|');
        CurrentItemCode = s[0];
        this.ilvRadToolTip.TargetControlID = s[2];   // "RadGrid1_ctl00__1";
        this.ilvRadToolTip.Show();
        LoadUserControl(PlaceHolder, CurrentControl, s[0], s[1]);
    }
}
the tooltip was shown at the right position but the picture inside tooltip was missing. I tried to setTargetControlID = RadGrid1.CientID and the tooltip was shown correctly and of course the position was according to the whole grid.
Is there any manipulation inside that caused this to happen ? Would there be any solution as to meet my requirement?
I would appreciate it very much if you could provide some advice. Thank you.

2 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 08 Nov 2011, 06:36 PM
Hi Tiger,

In order to achieve your scenario, you will be better off using the RadToolTipManager:
http://www.telerik.com/help/aspnet-ajax/tooltip-server-side-programming.html

You can dynamically add the grid rows to the target controls collection of the tool tip manager as follows:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        RadToolTipManager1.TargetControls.Add(e.Item.ClientID, true);           
    }
}



Hope it helps.

All the best, Tsvetoslav
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
0
TIGER
Top achievements
Rank 1
answered on 09 Nov 2011, 04:35 AM
Yes. It worked very well. Thank you!
Tags
Grid
Asked by
TIGER
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
TIGER
Top achievements
Rank 1
Share this question
or