ADAdministrator Syncfusion Team September 18, 2003 07:06 AM
If this is a GridControl, you can just set
this.gridControl1[0,2].CellTipText = "tip";
If this is a GriddataBoundGrid, then you would have to handle PrepareViewStyleInfo:
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
if(e.RowIndex == 0 && e.ColIndex == 2)
e.Style.CellTipText = "tip";
Hope that helps.
ADAdministrator Syncfusion Team September 18, 2003 07:41 AM
Not cell tooltip.
i was just asking about cell comments adding by the right upper corner red color, i found a sample there, but it is for GridControl
using this u can add/remove/edit comments
ADAdministrator Syncfusion Team September 19, 2003 05:44 AM
You cannot set cell specific properties (other than Text or CellValue) in a GridDataBoundGrid. The reason is that the the only cell specific storage available is what is in the data source (which is why you can change the Text or CellValue).
Since excelcomments are on a cell by cell basis, you need to do more work for them. One way to handle this problem is shown in this sample. It adds a hashtable to hold the styles for cells that an excelcomment. The key in this example is just the row and column numbers, which works OK as long as you do not sort the table of move teh columns. If you want to sort the table, then the row contribution to the key should be the unique ID value. And to allow moving columns, you could use the MappingName of teh column for the column contribution to the key.
Then Model.SaveCellInfo is handled to save to the hashtable the styles of any cells that you add comments to. Model.QueryCellInfo is handled to provide the save styles from the HashTable as needed.
ADAdministrator Syncfusion Team September 19, 2003 06:10 AM
Thanks for your customized solution
If possible give me VB version of it
will save lot of time for me
ADAdministrator Syncfusion Team September 19, 2003 07:38 AM
Here is the VB File
ADAdministrator Syncfusion Team September 26, 2003 06:23 AM
Thanks it is working fine, i understand the sorting problem also.
In the sample i have some doubts
But my question is,
say when i bind the grid to datasource, i just
want to specify those cells requires cell comments
in querycellinfo event, Can I ?
Because after setting the datasource, i have to loop throguh the datasource and set these lines
for the required lines right?
style = New ExcelTipDLL.GridExcelTipStyleProperties(GridDataBoundGrid1(1, 3))
style.ExcelTipText = "Comment for cell 1,3."
can we avoid this and can be done at querycell info event?
ADAdministrator Syncfusion Team September 26, 2003 06:56 AM
I don't know the details of the sample (and Clay is on vacation ...) but there should be no problem to provide the information you want to display in QueryCellInfo or PrepareViewStyleInfo. The Hashtable and/also looping though cells is only needed if you want to support to let the user modify the cell comments.
ADAdministrator Syncfusion Team September 29, 2003 08:09 AM
Here comes my modified requirement.
I am having a databoundgrid, where i am having say 3 columns, one is hidden, having notes say for 600 characters.
i just want to show this text as cell comment in column 2 (visible column)
How can i do it easily? without loopiong thru all the rows or by using querycell info
ADAdministrator Syncfusion Team September 29, 2003 02:13 PM
To do this replace the following two event handlers in the previous sample posted by Jay:
Private Sub grid_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
If e.RowIndex > 0 And e.ColIndex = 2 Then
Dim style As ExcelTipDLL.GridExcelTipStyleProperties = New ExcelTipDLL.GridExcelTipStyleProperties(e.Style)
style.ExcelTipText = "Large Large Comment for cells in column 2."
End Sub 'grid_QueryCellInfo
Private Sub grid_SaveCellInfo(ByVal sender As Object, ByVal e As GridSaveCellInfoEventArgs)
' Not needed.