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

Accessing a RECORD in a GridDataBoundGrid Control

Can I get a Record object for a GDBG like you can from a grouped grid using the code:

Record r=this.gridGroupingControl1.Table.Records[RecordIndex];

????

If not.. I HAVE to be able to populate a record with the data, it is essential for my project.

Thanks,

Henry


3 Replies

SK Sameer Khan December 18, 2008 06:28 PM UTC

If that is what you are after .,, then you can index the records collection; but you have the Collection object too [the one which is the source of your grid] Wouldn't you rather have the retrieval operation on the Collection rather than the grid?

And if you are looking for the index of the grid; then the record will absolutely exist.



HT Henry Thacker December 19, 2008 12:58 PM UTC

But a RECORD object is stored in Syncfusion.Grouping.Record, so I don't think this would be applicable to something from a Data bound grid (not a grouped one).

I am quite happy to access the data source, but I need a RECORD like object.. i.e. I can access a particular column from a given record by name.. something like a hashmap for a given row in the data source.



RC Rajadurai C Syncfusion Team December 20, 2008 09:14 AM UTC

Hi Henry,

Thanks for your interest in Syncfusion products.

Apologies for the delay.

Please try the following code snippet in buttonclick event handler where it retrieves the data of the selected record through the columnname.

CurrencyManager cm = (CurrencyManager)this.BindingContext[this.gridDataBoundGrid1.DataSource];
GridRangeInfoList list;
list = this.gridDataBoundGrid1.Selections.GetSelectedRows(true, false);
foreach (GridRangeInfo range in list)
{
for (int i = range.Top; i <= range.Bottom; i++)
Console.WriteLine(((DataView)cm.List).Table.Rows[this.gridDataBoundGrid1.Binder.RowIndexToPosition(i)]["Department"]);
}


Here is a minimal sample in which this code has been implemented. Please refer to this.
http://www.syncfusion.com/support/user/uploads/F78584_eb006cf0.zip

Regards,
Rajadurai



Loader.
Live Chat Icon For mobile
Up arrow icon