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

Tooltip in RadGrid

1 Answer 78 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Tony Deo
Top achievements
Rank 1
Tony Deo asked on 20 Nov 2009, 01:05 PM
Hi, I have a tooltip in a templated column within my radgrid.  I am trying to programmatically change the text on the tooltip depending upon a session variable.

However, I cannot seem to find the tooltip when I call it up in code.

Can anyone help.

I have posted my code.
<telerik:GridTemplateColumn UniqueName="TemplateColumn">  
            <EditItemTemplate> 
                <asp:Button runat="server" CommandName="Update" Text="Update" /> 
                &nbsp;<asp:Button runat="server" CausesValidation="false" CommandName="Cancel"   
                    Text="Cancel" /> 
            </EditItemTemplate> 
            <ItemTemplate> 
                <asp:ImageButton ID="ibPrint" runat="server" ImageUrl="~/Images/print2.jpg"   
                    CausesValidation="false" CommandName="Edit" BackColor="White" /> 
                <telerik:RadToolTip ID="ttibPrint" runat="server" TargetControlID="ibPrint" Text="print"</telerik:RadToolTip> 
            </ItemTemplate> 
            <ItemStyle BackColor="White" HorizontalAlign="Center" /> 
        </telerik:GridTemplateColumn> 
 If Session("UserCulture") = 2 Then 
            If TypeOf e.Item Is GridDataItem Then 
                Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)  
                Dim editBtn1 As RadToolTip = TryCast(item("TemplateColumn1").Controls(1), RadToolTip)  
                Dim editBtn3 As RadToolTip = TryCast(item("TemplateColumn").Controls(1), RadToolTip)  
                editBtn1.Text = "视图采购申请" 
                editBtn3.Text = "打印" 
            End If 
        End If 

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 24 Nov 2009, 01:27 PM
Hi Tony Deo,

Since the grid item is an Inaming Conatiner you should use it as such and find the tooltip by uisng the FindControl method in similar manner as this:

item.FindControl("ttibPrint")

Note, also that you do not need the GridDataItem, but you should use the following condition:

If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem

All the best,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ToolTip
Asked by
Tony Deo
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or