We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cell tooltip based on the value of a different cell

Hi,

Searching the forums, came across this one, but the example leads me to a dead link.

http://www.syncfusion.com/support/forums/grouping%20-windows/20572/Setting-Cell-Tool-Tip-via-eInnerStyleCellTipText

I need to set the tooltip for each of the cells in a column based on the value of a different column.

this is what i tried and dosent seem to do the trick.

private void gridPending_TableControlPrepareViewStyleInfo( object sender, GridTableControlPrepareViewStyleInfoEventArgs e )
{
if ( e.Inner.ColIndex > 0 && e.Inner.RowIndex > 2 )
{
//if ( gridPending.TableModel[e.Inner.RowIndex, gridPending.TableModel.NameToColIndex( "AltLocRequired" )].CellValue.ToString().Trim() == "Y" )
//{
// gridPending.TableModel[e.Inner.RowIndex, gridPending.TableModel.NameToColIndex( "Approve" )].CellTipText = "Alternate Location required";
//}
}
}

3 Replies

LS Lingaraj S Syncfusion Team February 4, 2010 09:15 AM UTC

Hi Kannan,

Thank you for your interest in Syncfusion products.

Please try using below way in GridGroupingControl to show the Cell ToolTip based on another column value as shown below.

this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.Column != null
&& e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record
&& e.TableCellIdentity.Column.Name == "Approve")
{
object val = e.TableCellIdentity.DisplayElement.GetRecord().GetValue("AltLocRequired");
if (val != null && val.Equals("Y"))
{
e.Style.CellTipText = "Alternate Location required";
}
}
}


Refer the simple sample from below link for your reference.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GGCControl1002668115.zip

Please let me know if you have any queries.

Regards,
Lingaraj S.


KV Kannan Venkataramani February 5, 2010 04:38 PM UTC

Hi Lingaraj,

Thanks for the help, my situation is a bit different, my grid is bound to a Dataset and the Dataset is updated by a backend EMS data provider, and its updated as and when trades come in.

So the querycellinfo dosent seem to fire on such occasions, so is there any other way to set the tooltip.


LS Lingaraj S Syncfusion Team February 9, 2010 08:59 AM UTC

Hi Kannan,

Thank you for the update.

Try using Refresh method in SourceListListChanged event to fire the QueryCellInfo event while updaing datasource as shown below.

this.gridGroupingControl1.SourceListListChanged += new TableListChangedEventHandler(gridGroupingControl1_SourceListListChanged);
void gridGroupingControl1_SourceListListChanged(object sender, TableListChangedEventArgs e)
{
this.gridGroupingControl1.Refresh();
}


Please let me know if you have any queries.

Regards,
Lingaraj S.

Loader.
Live Chat Icon For mobile
Up arrow icon