Reputation: 146
Greeting to all,
Please help me how to set back again the tooltip text of row header of datagridview, When I load the datatable and set each tooltip for rows of datagridview, its show correctly when I move mouse pointer to row header but when I click the column to sort the data to ascending or descending the tooltip for the row header was remove ? how I can set it back or to avoid it when I clicking the column header of datagridview .... thanks in advance !
Upvotes: 1
Views: 2023
Reputation: 5454
Move the code that sets your row tooltips to the DataBindingComplete
event handler. This handle will trigger every time the DataSource
updates (which includes sorting). Like so:
this.dataGridView1.DataBindingComplete += DataGridView1_DataBindingComplete;
private void DataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
foreach (DataGridViewRow row in this.dataGridView1.Rows)
{
row.HeaderCell.ToolTipText = "ToolTip Text";
}
}
Upvotes: 2
Reputation: 16956
Set ToolTipText
property on DataGridViewColumn
foreach (DataGridViewColumn column in dataGridView1.Columns)
{
column.ToolTipText = "Tooltip"; // set here.
}
Upvotes: 1