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

Can I product cell comments sample for DataBoundGrid?


9 Replies

AD Administrator Syncfusion Team September 18, 2003 11:06 AM UTC

Hi Rajaraman, 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. Regards, Stephen.


AD Administrator Syncfusion Team September 18, 2003 11:41 AM UTC

Hi stephen 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 Regards Rajaraman


AD Administrator Syncfusion Team September 19, 2003 09:44 AM UTC

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.


AD Administrator Syncfusion Team September 19, 2003 10:10 AM UTC

Hi Clay It's great! Thanks for your customized solution If possible give me VB version of it will save lot of time for me Bye Rajaraman


AD Administrator Syncfusion Team September 19, 2003 11:38 AM UTC

Here is the VB File Regards, Jay N


AD Administrator Syncfusion Team September 26, 2003 10:23 AM UTC

Hi Jay 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? Regards Rajaraman


AD Administrator Syncfusion Team September 26, 2003 10:56 AM UTC

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. Stefan


AD Administrator Syncfusion Team September 29, 2003 12:09 PM UTC

Hi 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 Regards Rajaraman


AD Administrator Syncfusion Team September 29, 2003 06:13 PM UTC

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 If End Sub 'grid_QueryCellInfo Private Sub grid_SaveCellInfo(ByVal sender As Object, ByVal e As GridSaveCellInfoEventArgs) ' Not needed. End Sub Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon