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

Tooltip in grid column

3 Answers 507 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sam
Top achievements
Rank 1
sam asked on 20 Jul 2010, 12:33 PM
Hello i am using  Rad grid ..my code is the following
 <Columns>
        <telerik:GridBoundColumn DataField="imgTitle" HeaderText="imgTitle"
            SortExpression="imgTitle" UniqueName="imgTitle">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="imgID" DataType="System.Int32"
            HeaderText="imgID" ReadOnly="True" SortExpression="imgID" UniqueName="imgID">
        </telerik:GridBoundColumn>
          <telerik:GridTemplateColumn DataField="Image" HeaderText="Image"
            SortExpression="Image" UniqueName="Image">
              <ItemTemplate>
                 
                    <img src='<%# Eval("imgFile") %>' id="image1" width="30px" height="50px" />
               
                    
               
                </ItemTemplate>
           
        </telerik:GridTemplateColumn>
    </Columns>



I need to insert Tooltip for each cell in column image to show this text in tooltip " view album"
please help

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 20 Jul 2010, 01:13 PM
Hello Sam,

The following code snippet will help you to show tooltip for GridTemplateColumn.

CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        item["image"].ToolTip = "View album";
    }
}


-Shinu.
0
sam
Top achievements
Rank 1
answered on 20 Jul 2010, 01:44 PM
It works fine and here is the vb code
  Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid1.ItemDataBound
        If TypeOf e.Item Is GridDataItem Then
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            item("image").ToolTip = "View album"
        End If
    End Sub


but i would like to use RadTooltip )
i tried inside item template
 <ItemTemplate>
                 
                    <img src='<%# Eval("imgFile") %>' id="image1" width="30px" height="50px" />
                 <telerik:RadToolTip ID="RadToolTip2" runat="server"
                    TargetControlID="image1" Text="hi" Title="ello" ToolTip="hiiiiii">
                </telerik:RadToolTip>
                </ItemTemplate>

but i am getting error :

Cannot find a server control with ID=image1. If you need to specify a client-side element ID, please set IsClientID to true.

ok i changed isclientId to true
in result only in the first row the rad tooltip appear.
in other rows  radtooltip doesn t appear

please help
0
sam
Top achievements
Rank 1
answered on 21 Jul 2010, 09:54 AM
Thank man for your support
I have solved like this

<ItemTemplate >
                <asp:HyperLink ID="HyperLink1" runat="server" Width="10px" Height="50px"
                   >
                   <asp:Image ID="Image2" runat="server" Width="90px" Height="120px" ImageUrl='<%# Eval("imgFile") %>'  ToolTip="Show album"    RelativeTo="Element" Position="MiddleRight" EnableShadow="true"/> </asp:HyperLink>
                <telerik:RadToolTip ID="RadToolTip3" runat="server" TargetControlID="image2"
                    Animation="Slide" Position="MiddleRight">
                </telerik:RadToolTip>
            </ItemTemplate>
Tags
Grid
Asked by
sam
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
sam
Top achievements
Rank 1
Share this question
or