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

Retrieving Column header text

I am sure this is probably just a syntax mistake. But I just want the column header text. Both of these lines of code return a blank text
note: cCell => currentcell

mytextbox.Text = grid.Text & "!" & grid(0, cCell.ColIndex).CellValue & cCell.RowIndex

mytextbox.Text = grid.Text & "!" & grid.ColStyles(cCell.ColIndex).Text & cCell.RowIndex

the grid text and the row index are correct, but the column header text is not being returned. Anybody have any ideas?

Thanks folks for the feedback!

3 Replies

PR Pratima September 21, 2007 10:47 PM UTC

Try :
grid.Binder.InternalColumns[cCell.ColIndex].HeaderText

>I am sure this is probably just a syntax mistake. But I just want the column header text. Both of these lines of code return a blank text
note: cCell => currentcell

mytextbox.Text = grid.Text & "!" & grid(0, cCell.ColIndex).CellValue & cCell.RowIndex

mytextbox.Text = grid.Text & "!" & grid.ColStyles(cCell.ColIndex).Text & cCell.RowIndex

the grid text and the row index are correct, but the column header text is not being returned. Anybody have any ideas?

Thanks folks for the feedback!


EC Eric Carley September 22, 2007 12:24 AM UTC

I am sorry, but I should have stated that this is an unbound grid. I cannot find any documentation on binding.internalcolumns on unbound grids. If I have missed something, please let me know.

Thank you for the feedback - but do you have any other ideas?


JJ Jisha Joy Syncfusion Team September 26, 2007 08:37 AM UTC

Hi Eric,

Thank you for posting your query to us.

1,Regarding the Column header
................

I am afraid that I was not able to reproduce the issue.I have created a simple sample to test this issue and is working fine.
Here is the code snippet:

Me.TextBox1.Text = Me.GridControl1.Text & "!" & Me.GridControl1(0, Me.GridControl1.CurrentCell.ColIndex).CellValue & Me.GridControl1.CurrentCell.RowIndex


Please refer the following sample that illustates the same :
http://websamples.syncfusion.com/samples/Grid.Windows/68457/main.htm

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample or send us the reproducing steps so that we could sort out the cause of the issue
and provide you a solution?

2, Regarding how to bind an external datasource
...................

Please refer the following Browser samples that shows how to virtually bind an external datasource to gridcontrol:
C:\Documents and Settings\{username}\My Documents\Syncfusion\EssentialStudio\5.2.0.25\Windows\Grid.Windows\Samples\2.0\VirtualGrid

Let me know if you have any questions.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon