Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 492429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T02:06:41+00:00 2026-05-13T02:06:41+00:00

complete novice at work (who is also ill and feeling particularly thick) I have

  • 0

complete novice at work (who is also ill and feeling particularly thick)

I have the following code that gives me a generic “tool tip text” for each heading in a gridview….great.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
    if (e.Row.RowType == DataControlRowType.Header) 
    { 
        foreach (TableCell cell in e.Row.Cells) 
        { 
            foreach (System.Web.UI.Control ctl in cell.Controls) 
            { 
                if (ctl.GetType().ToString().Contains("DataControlLinkButton")) 
                { 
                    cell.Attributes.Add(
                        "title", "tooltip text for " + ((LinkButton)ctl).Text);
                }
            } 
        }
    }
}

What is not so great is that I obviously don’t want all of the cells to return the same generic ‘ tooltip text for’.

How would a simpleton like me adapt the code so that for the ProductID heading cell the tt says “a unique product reference”, for a Product Description heading cell the tt returns “description of the the product”.

Apologies for the dim question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T02:06:41+00:00Added an answer on May 13, 2026 at 2:06 am

    If I understand correctly, you want the tooltip to be set corresponding to the column title ?

    You could do something like this :

    if (ctl.GetType().ToString().Contains("DataControlLinkButton")) 
    {
        String headerText = cell.Text;
        cell.Attributes.Add("title", headerTooltips[headerText]);
    }
    

    where headerTooltips is a dictionary defined before :

    Dictionary<String, String> headerTooltips = new Dictionary<String, String>();
    headerTooltips["Product ID"] = "A unique product ID";
    [...]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that run on heroku inside a controller that intermittently
Complete C++ i18n gettext() hello world example has C++ code that works for a
I have used auto complete textbox previously. That auto complete works only when i
I am a complete novice at php and postgres. I have been searching all
What is the average time that it would take a complete novice, whose background
I am a complete novice to C, and during my university work I've come
So, to preface, I'm a complete novice at this Excel business. I've found similar
Preface: I consider myself slightly effective in ruby on rails, and a complete novice
Complete new person to Ruby and Rails here... Have tried some tutorials in the
The complete code is copied and pasted below. I am new to javascript and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.