Go Back   DeveloperBarn Forums > Programming & Scripting > Code Samples

Sponsored Links

Discuss "Create ToolTip for GridView Header" in the Code Samples forum.

Code Samples - Search through our code samples to give your application that something extra or provide a code sample of your own.


Reply « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1  
Old March 21st, 2008, 02:26 PM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 820
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft .Net Microsoft SQL Server Microsoft Windows Classic ASP 
Total Awards: 4

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.

Join our Folding team: DeveloperBarn Folding
Reply With Quote
Sponsored Links
Reply

  DeveloperBarn Forums > Programming & Scripting > 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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Create History Table / Outcome results Rebelle Database Design Help 9 July 1st, 2008 08:33 AM
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 04:14 PM.



Content Relevant URLs by vBSEO 3.2.0