How do I set the text of the tooltip in a gridview row at runtime?

I have a gridview and the 2nd column is a template with a single asp:Imagebutton control in it (see code snippet #1). I want to set the text for the tooltip on a row-by-row basis in the VB code at runtime based on the text of 2 other columns in the gridview (see code snippet #2). This is not working and shows .tooltip as not a member of System.Web.UI.Control in VWD 2005. My question is twofold: 1) Can I set the tootip for the image to a different value for each row? and 2) How do I do it?
(snippet #1)
<asp:TemplateField HeaderText="R">
                    <ItemTemplate>
                        <center>
                            <asp:ImageButton ID="ibtnShowRetail" ImageUrl="/ugwImages/button-exclamation.gif"
                                runat="server" ToolTip="Put Retail $ in Here!" />
                        </center>
                    </ItemTemplate>
                </asp:TemplateField>
 
(Snippet #2)
Protected Sub gvSearchResults_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvSearchResults.RowDataBound
    If e.Row.RowType = DataControlRowType.DataRow Then
        e.Row.Cells(2).Controls(1).ToolTip = "Resell 1: " & e.Row.Cells(7).Text & " Resell 2: " & e.Row.Cells(8).Text
    End If
End Sub

Open in new window

ovcbsAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ovcbsConnect With a Mentor Author Commented:
I found the solution myself. By creating 2 variables for the text boxes I was trying to access and using the FindControl method to place them into these variables I was able to access them the same way I accessed the image button.
0
 
ovcbsAuthor Commented:
I managed to get at the tooltip:

Protected Sub gvSearchResults_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvSearchResults.RowDataBound
        Dim MyControl As System.Web.UI.Control
        Dim MyImageButton As ImageButton
        If e.Row.RowType = DataControlRowType.DataRow Then
            MyControl = e.Row.FindControl("ibtnShowRetail")
            MyImageButton = MyControl
            MyImageButton.ToolTip = "Resell 1: " & e.Row.Cells(7).Text & " Resell 2: " & e.Row.Cells(8).Text
         End If
    End Sub

But the tooltip just shows "Resell1: Resell 2:" Without any data from the other cells.
0
All Courses

From novice to tech pro — start learning today.