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

DataGrid RowHeader Text

How do you edit the RowHeader Text of a DataGrid programmatically?

Rows default to "1, 2, 3" and so on. I would like to fill those cells other values such as a customer name, for example.

Thanks, Greg

4 Replies

SA Saravanan A Syncfusion Team May 7, 2007 05:06 PM UTC

Hi Greg,

You can achieve this through the GridStyleInfo object of RowHeader Cell.
Here is the code snippet.

GridStyleInfo style = gridControl1[1, 0];
style.CellValue = "Customer Name";

Best Regards,
Saravanan


GG Greg Goodall May 7, 2007 08:02 PM UTC

Thanks for the tip. My final code looks something like this. I actually have a loop to format multiple rows with differing Customer Names, but this gives the concept.

Dim CustomerName as String
Dim style As GridStyleInfo = GridControl1(i, 0)

CustomerName = "Bob Smith"
style.CellValue = BoxNumber
GridControl1.ChangeCells(GridRangeInfo.Cells(i, 0, i, 0), style)


GG Greg Goodall May 7, 2007 08:05 PM UTC

I had an error in my last post. I should read like this

style.CellValue = CustomerName


SA Saravanan A Syncfusion Team May 7, 2007 08:52 PM UTC

Hi Greg,

To set the text to a range of Cells in a grid you can use the GridControl.PopulateValues method. Please refer to the following sample.
Sample: http://websamples.syncfusion.com/samples/Grid.Windows/F60509/main.htm

Best Regards,
Saravanan

Loader.
Live Chat Icon For mobile
Up arrow icon