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.

Retrieve records of child table grouped by GroupedColumns

Thread ID:

Created:

Updated:

Platform:

Replies:

120043 Aug 26,2015 08:51 AM Sep 2,2015 08:26 AM Windows Forms 5
loading
Tags: GridGroupingControl
Rasika
Asked On August 26, 2015 08:51 AM

Hello,
I have parent-child relationship in GGC. I have added a grouped column by which the relationship is showed in GGC.
I want to retrieve all records of grouped column when I double click on that grouped column.
I used GridTableModel, GridTableCellStyleInfo,GridTableCellStyleInfoIdentity to fetch records,but when I double clicked on grouped column, it gives null records.
Please give me any solution regarding to this.

Thank you and regards,
Rasika


Adhikesevan Kothandaraman [Syncfusion]
Replied On August 27, 2015 09:21 PM

Hi Rasika,

Thank you for your interest in Syncfusion products.

We have analyzed your reported scenario at our end. As per your scenario you are getting the records through GridTableCellIdentity. Instead of using that you can use the grid.Table.TopLevelControl.Groups to get the records from the groups. It will retrieve the records based on the grouped levels. Please refer the below codeSnippet,

Code Snippet:

//To get all the records of the group

string data = "";

for (int i = 0; i < this.gridGroupingControl1.Table.TopLevelGroup.Groups.Count; i++)

{

   for(int j=0;j<this.gridGroupingControl1.Table.TopLevelGroup.Groups[i].Records.Count;j++)

   {

       data = this.gridGroupingControl1.Table.TopLevelGroup.Groups[i].Records[j].ToString()+"\n";

   }
}

If the TopLevelGroup.Groups has the nested group then the records collection is available in the inner group of the Groups collection that is Groups[Index].Groups[InnerGroupIndex].Records has the record values.


Please let me know if you have any concern.

Regards,
Adhi.


Rasika
Replied On August 28, 2015 01:44 AM

Hello,
Thank you for reply.
But in my application I got this.gridGroupingControl1.Table.TopLevelGroup.Groups.Count = 0
So it finishes the for loop.
I have added grouped column 'Year' using following code. 
GGC.TableDescriptor.Relations[0].ChildTableDescriptor.GroupedColumns.Add("Year");
I am attaching 2 image files of my GGC. Please find the attachments.
In first image I want to double click on any of the year row.
If suppose I clicked on 'Year 2012' row then I want to fetch 9 records of that year as shown in the second image.
Please suggest any solution for this.

Thank you and regards,
Rasika

Attachment: GGC_ScreenShots_13e5a863.rar

Adhikesevan Kothandaraman [Syncfusion]
Replied On August 31, 2015 07:07 AM

Hi Rasika,

Thank you for your update.

We have analyzed your query at our end. If you want to get the records of the groups based on double click on the cell, you can achieve it by using the element.ParentGroup.Records. Please refer the below code example,,

Code Example:

GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
Element el = style.TableCellIdentity.DisplayElement;
if (el != null)
{
string s = "";
foreach (Record rec in el.ParentGroup.Records)
{
//Retrieves the Records of the parent group
s += rec.ToString() + Environment.NewLine;
}
//Shows the Content in the MessageBox
MessageBox.Show(s);
}

Sample:
http://www.syncfusion.com/downloads/support/forum/120043/ze/ChildGroup-2057188902

Regards,
Adhi

Rasika
Replied On September 1, 2015 05:52 AM

Hello,
Thank you for reply.It works.
Thank you so much.

Regards,
Rasika

Ranjani Prabhakaran [Syncfusion]
Replied On September 2, 2015 08:26 AM

Hi Rasika,
 
Thanks for the update.
 
Please let us know if you need any assistance.
 
Regards,
 
Ranjani

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.

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.

;