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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Unique identifier in GGC and fetch this ID for a given value in a column

Thread ID:

Created:

Updated:

Platform:

Replies:

125689 Sep 2,2016 05:02 PM UTC Sep 7,2016 04:38 AM UTC Windows Forms 5
loading
Tags: GridGroupingControl
Nicolas
Asked On September 2, 2016 05:02 PM UTC

Hi, I have twofold question today for you, I have seen earlier that the index might not be the best unique identifier for a record, as it might change depending on the sorting made on it, hence I believe that GGC.Table.CurrentRecord.Id might the best unique identifier for a record in the grid, Am I correct? Second question is as follows: Is it possible to find this record ID (without going through a loop if possible) or any other unique record identifier you would recommend on the first question, using a known Column name and a unique value in this column
Thanks in advance - Nicolas

Mohanraj Gunasekaran [Syncfusion]
Replied On September 5, 2016 10:36 AM UTC

Hi Nicolas, 

Thanks for using Syncfusion products, 

Please find the below response for your queries. 

 
 
Qurey1: 
 have seen earlier that the index might not be the best unique identifier for a record, as it might change depending on the sorting made on it, hence I believe that GGC.Table.CurrentRecord.Id might the best unique identifier for a record in the grid, Am I correct? 

Yes, Record.Id is the unique identifiers for the record. Each row is having identifiers in GridGroupingControl. 
 
 
 
Qurey2: 
Second question is as follows: Is it possible to find this record ID (without going through a loop if possible) or any other unique record identifier you would recommend on the first question, using a known Column name and a unique value in this column 
 
 
In order to get the record based on the id, you can use this differentiated id in Table.UnsortedRecords to retrieve the record. Please refer the below code snippet and refer the attached sample. 
 
Code snippet: 
//Get the first record id initially. 
startingRecordId = this.gridGroupingControl1.Table.Records(0).Id 
 
//In ClipboardCopy event 
Dim currentRecordId As Integer = Me.gridGroupingControl1.Table.CurrentRecord.Id 
Dim recordIndex As Integer = currentRecordId - startingRecordId 
copiedrecord = Me.gridGroupingControl1.Table.UnsortedRecords(recordIndex) 
 
 

Sample link: DataGrid 

Regards, 
Mohanraj G. 
 


Nicolas
Replied On September 5, 2016 06:36 PM UTC

Hi Mohanraj, the UnsortedRecords approach is great and is bringing me a great deal of comfort for the index I use in a lot of places in my app!!!

If you do not mind, I would like to clarify the 2nd question. Say I have a column called "IssueNo", and another column called "DateReported", I would like to make a query that would read as this in SQL "SELECT DateReported FROM MyTable WHERE IssueNo = 'ISS 003'. I believe that could be done in finding the ID (or the index) where IssueNo = '003', and use same ID or index to find the DateReported, could you walk me through a solution here? Thanks in advance - Nicolas

Mohanraj Gunasekaran [Syncfusion]
Replied On September 6, 2016 02:28 PM UTC

Hi Nicolas, 

Thanks for your update, 

We do not have a direct support to get the specific cell values without looping. In order to get the specific column value, you can use the TableDescriptor.RecordFilters and Record.GetValue method. Please refer the below code snippet and refer the attached sample. 

Code snippet: 
 
Me.gridGroupingControl1.TableDescriptor.RecordFilters.Add("[Name] like 'John'") 
 
For i As Integer = 0 To Me.gridGroupingControl1.Table.FilteredRecords.Count - 1 
   value += vbLf + Me.gridGroupingControl1.Table.FilteredRecords(i).GetValue("Id") 
Next 
 
Me.gridGroupingControl1.TableDescriptor.RecordFilters.Clear() 
 
Sample link: DataGrid 

Regards, 
Mohanraj G. 


Nicolas
Replied On September 7, 2016 01:09 AM UTC

Works like a charm!!! Thank you for your precious help! - Nicolas

Mohanraj Gunasekaran [Syncfusion]
Replied On September 7, 2016 04:38 AM UTC

Hi Nicolas, 

Thanks for your update,  
 
We are glad to know that your reported problem has been resolved. Please let us know if you need any further assistance.  
 
Regards,  
Mohanraj G.  


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

;