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

Looping through a GGC current record (selected record) and getting headers

Hi,
Can I loop through an actively selected record in a GGC and get the column headers as well as the value in that Row, Col?
I'm able to get individual values using:

this.trancheGridGrouper.Table.Records.Count...

this.myGGC.TableModel[x, y].Text

but I would like to do it by the header and get the header so I can pass it with the cell value

Thanks,
Dimitri

3 Replies

AD Administrator Syncfusion Team February 26, 2007 10:23 PM UTC

Hi Dimitri,

You can turn ON the record based selection using ListBoxSelectionModeproperty and call the Table.GetTableCellStyle method to get the selected record cell style information using the column header name.Below is a code snippet.

foreach( SelectedRecord rec in this.gridGroupingControl1.Table.SelectedRecords)
{
GridTableCellStyleInfo style = this.gridGroupingControl1.Table.GetTableCellStyle(rec.Record,"ColumnHeaderName");
Console.WriteLine( style.Text );
}

Sample : http://www.syncfusion.com/Support/user/uploads/GGC_ColumnHeader_c188c538.zip

Best regards,
Haneef


AD Administrator Syncfusion Team February 27, 2007 04:18 PM UTC

Thanks Haneef,
Will that give me the cell content for that selected record and header? I would like to get the cell value by knowing the column header name,
The CellStyle equivalent of:

this.GGC.TableModel[row, 2].Text;



Dimitri

>Hi Dimitri,

You can turn ON the record based selection using ListBoxSelectionModeproperty and call the Table.GetTableCellStyle method to get the selected record cell style information using the column header name.Below is a code snippet.

foreach( SelectedRecord rec in this.gridGroupingControl1.Table.SelectedRecords)
{
GridTableCellStyleInfo style = this.gridGroupingControl1.Table.GetTableCellStyle(rec.Record,"ColumnHeaderName");
Console.WriteLine( style.Text );
}

Sample : http://www.syncfusion.com/Support/user/uploads/GGC_ColumnHeader_c188c538.zip

Best regards,
Haneef


AD Administrator Syncfusion Team February 28, 2007 12:01 AM UTC

Hi Dimitri,

The CellStyle equivalent of: this.GGC.TableModel[row, 2].Text;
>>>>>>
You can try the below code snippet

//Get ColumnName from ColIndex.
int field = this.gridGroupingControl1.TableDescriptor.ColIndexToField(2);
string ColumnName = this.gridGroupingControl1.TableDescriptor.Fields[field].Name;

//Get Recor from RowIndex.
Record rec =this.gridGroupingControl1.Table.DisplayElements[row].ParentRecord;

GridTableCellStyleInfo style = this.gridGroupingControl1.Table.GetTableCellStyle(rec,ColumnName);
Console.WriteLine( style.Text );

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon