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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Accessing record based on Primary Key

Thread ID:

Created:

Updated:

Platform:

Replies:

63713 Jul 9,2007 03:15 AM UTC Jul 10,2007 05:10 PM UTC WinForms 3
loading
Tags: Grouping
Patrick Cheng
Asked On July 9, 2007 03:15 AM UTC

Hi,

I have a GGC that is has a datatable as a datasource. I have set a primary key column in the datasource. Now, how can I access records in the GGC by way of the primary key from the underlying datasource?

Many thanks!

haneefm [Syncfusion]
Replied On July 9, 2007 10:25 PM UTC

Hi Patrick,

You can use the Table.Records property to get the collection of sorted record elements that are children of a Table. This collection contains all records, it is not filtered. The collection provides support for determining a record's position in the grouped table using the RecordsInTableCollectionBase.IndexOf method.

[c#]
foreach( Record rec in this.grid.Table.Records)
Console.Writeline( rec.Info );

Use Table.UnsortedRecords proeprty to get the collection of unsorted Record elements that are children of a Table and represent the original records in the same order as the underlying data source. The collection provides support for determining a record's underlying position in the datasource using the UnsortedRecordsCollection.IndexOf method.

[c#]
foreach( Record rec in this.grid.Table.UnsortedRecords)
Console.Writeline( rec.Info );

Best regards,
Haneef

Patrick Cheng
Replied On July 10, 2007 01:33 AM UTC

Hi Haneef,

the methods you provided assumes that i provide a record value to get the index. but what i want to accomplish is to find the record based on a primary key, which is an integer value. for example, in a datatable you can do something like

table.rows.find(key)

is there something similair with the ggc that i can implement? or would i need to just loop through each record and look for a match?

haneefm [Syncfusion]
Replied On July 10, 2007 05:10 PM UTC

Hi Patrick,

You can use the Table.PrimaryKeySortedRecords property to get the collection of primary key sorted record elements that are children of a Table. The collection provides support for determining a record in the grouped table using the FindRecord(sortKey)/ method. Below is a code snippet

this.gridGroupingControl1.Table.PrimaryKeySortedRecords.FindRecord(sortKey);

Best regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;