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
close icon

tool tip for a record

hi I need to display a tool tip for a record whenever the mouse hovers above it.How to achieve this? regards, Catinat

8 Replies

AD Administrator Syncfusion Team July 25, 2005 10:07 AM UTC

Handle the PrepareViewStyleInfo the value of e.RowIndex.


CV Catinat Velmourougan July 25, 2005 10:23 AM UTC

hi , Your reply is unclear to me. I have gone searched through your KB, Forums and samples and found only tool tip texts for a cell. The requirement is for current row. Can you explain in more detail? regards, Catinat


CV Catinat Velmourougan July 25, 2005 10:36 AM UTC

hi Heres the code which I think will throw up more insight into my problem, In my mouse hover event I have written this code : Record record = this.GroupingGrid.SyncfusionGridControl.Table.CurrentRecord; string col1 = Convert.ToString(record.GetValue("COL1")); string col2 = Convert.ToString(record.GetValue("COL2")); string toolTipText = col1 + col2; How to set this toolTiptext to the current row?


AD Administrator Syncfusion Team July 25, 2005 10:38 AM UTC

1) Subscribe to the grid.PrepareViewStyleInfo event. 2) In your handler, set the e.Style.CellTipText property based on e.RowIndex.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.ColIndex > 0 && e.RowIndex > 0)
	{
		e.Style .CellTipText = string.Format("Tip for row {0}. Cell value={1}", e.RowIndex, this.gridDataBoundGrid1[e.RowIndex, e.ColIndex].CellValue);
	}
}

http://www.syncfusion.com/Support/user/uploads/GDBG_ToolTip_c30e09f6.zip


AD Administrator Syncfusion Team July 25, 2005 10:47 AM UTC

You did not mention you were using a GridGroupingControl. Instead of PrepareViewStyleInfo, in a GridGroupingControl, you should use the QueryCellStyleInfo event to set the tip.
private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
	if(e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell
		|| e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
	{
		GridRecordRow rec = e.TableCellIdentity.DisplayElement as GridRecordRow;
		if(rec.ParentRecord != null)
		{
			e.Style.CellTipText = rec.ParentRecord.GetValue("Col1") + "  " + rec.ParentRecord.GetValue("Col2");
		}
	}
}


CV Catinat Velmourougan July 25, 2005 10:49 AM UTC

hi, I havent yet tried what you said. I feel it may not work. Will the following conditions prevent the above solution from working? Its grouping grid. I dont know the index of cols, only names. These cols are not visible cols.


AD Administrator Syncfusion Team July 25, 2005 11:39 AM UTC

The code I posted for QueryCellStyleInfo above was copied it from a working sample. Try it. http://www.syncfusion.com/Support/user/uploads/GDBG_ToolTip_44ab7f50.zip


CV Catinat Velmourougan July 25, 2005 12:39 PM UTC

Its working fine. Thanks Regards, Catinat

Loader.
Live Chat Icon For mobile
Up arrow icon