DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

Create ToolTip for GridView Header

This is a discussion on Create ToolTip for GridView Header within the .Net Code Samples forums, part of the .Net Development category; The following allows you to add a tooltip to the header links of your GridView, a feature that is lacking. ...

Go Back   DeveloperBarn Forums > Programming & Scripting > .Net Development > .Net Code Samples

  #1  
Old March 21st, 2008, 02:26 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Real name: Jason
Location: Washington, D.C.
Posts: 1,915
Blog Entries: 7
Rep Power: 13
jmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud ofjmurrayhead has much to be proud of
Default Create ToolTip for GridView Header

The following allows you to add a tooltip to the header links of your GridView, a feature that is lacking.

VB.Net Code:
Code:
Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GridView1.RowDataBound
    ' Check the row type is header
    If e.Row.RowType = DataControlRowType.Header Then
        For Each cell As TableCell In e.Row.Cells
            For Each ctrl As Control In cell.Controls
                If ctrl.GetType().ToString().Contains("DataControlLinkButton") Then
                    cell.Attributes.Add("title", CType(ctrl, LinkButton).Text)
                End If
            Next
        Next
    End If
End Sub
C# code:
Code:
private void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
    //Check the row type is header 
    if (e.Row.RowType == DataControlRowType.Header) { 
        foreach (TableCell cell in e.Row.Cells) { 
            foreach (Control ctrl in cell.Controls) { 
                if (ctrl.GetType().ToString().Contains("DataControlLinkButton")) { 
                    cell.Attributes.Add("title", ((LinkButton)ctrl).Text); 
                } 
            } 
        } 
    } 
}
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

If you like it here...throw us a few bones to help
support us.

Join our Folding team: DeveloperBarn Folding

Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > .Net Development > .Net Code Samples

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Create History Table / Outcome results Rebelle Database Design Help 11 June 10th, 2009 10:54 AM
Form Design: Label in Header Control in details nboscaino Microsoft Access 2 August 28th, 2008 06:03 PM
Is there an easier way to create a countif function? Lauramc Visual Basic Programming 0 August 7th, 2008 06:26 PM
add additional footer to gridview peebman2000 .Net Development 13 May 2nd, 2008 01:50 PM
Create Virtual Directories in IIS jmurrayhead Microsoft IIS 0 March 21st, 2008 10:08 AM


All times are GMT -4. The time now is 02:05 AM.


Copyright ©2008-2009, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2