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.

Get multiple selected record in GGC v 4.1.0.58 .Net 2003

Thread ID:

Created:

Updated:

Platform:

Replies:

67330 Aug 14,2007 08:48 AM Aug 27,2007 08:07 PM Windows Forms 3
loading
Tags: GridControl
Abhijeet Kumar
Asked On August 14, 2007 08:48 AM

Hi
I am using GGC ver: 4.1.0.58 in .Net 2003 application.
I am using following code to populate parent child data in a grid.

parentTable = GetParentTable();
childTable = GetChildTable();

GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor();
parentToChildRelationDescriptor.ChildTableName = "MyChildTable"; // same as SourceListSetEntry.Name for childTable (see below)
parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
parentToChildRelationDescriptor.RelationKeys.Add("BasketName", "BasketName");

// Add relation to ParentTable
gridGroupingControl1.TableDescriptor.Relations.Add(parentToChildRelationDescriptor);

this.gridGroupingControl1.Engine.SourceListSet.Add("MyParentTable", parentTable);
this.gridGroupingControl1.Engine.SourceListSet.Add("MyChildTable", childTable);

this.gridGroupingControl1.DataSource = parentTable;


Now i have to get all the selected child records on click of context menu.

I tried GridRecord curRecord = gridGroupingControl1.Table.CurrentRecord as GridRecord;
but this returns only the parent selected records.

then i tried doing
Table t = gridGroupingControl1.Table;
SelectedRecordsCollection coll = t.SelectedRecords;

but this too does not work. Please let me know how can i get the selected record of the child table on click of context menu.

Thanks

haneefm [Syncfusion]
Replied On August 14, 2007 11:27 AM

Hi Abhijeet,

In a flat groupinggrid, you can get the selected records in this manner.

GridTable gt = this.gridGroupingControl1.Table;
foreach(SelectedRecord rec in gt.SelectedRecords)
{
Console.WriteLine(rec.Record);
}

With the nested tables, you need to get the child table you want, and do the same type of thing. Here is a code snippet

GridTable gt = this.gridGroupingControl1.GetTable("ChildTable");
foreach(SelectedRecord rec in gt.SelectedRecords)
{
Console.WriteLine(rec.Record);
}

Please refer to the attached sample for getting selected record in a grid.
GGC_NestedTable.zip

Best Regards,
Haneef

Abhijeet Kumar
Replied On August 16, 2007 04:56 AM

Hi Haneef,
Thanks for your reply, this has solved my problem, But now i am facing anew problem on the same grid.
When i double click on the Row header of the Child data, i am getting an error saying that

"Specified argument was out of the range of valid values."

I have not handled any grid event in my code from where this event can be generated. Also when i try to Debug the code by selecting "Break into debugger" option from the Debug--> Exceptions window, it does not break into any place in my Code.

Abhi....

>Hi Abhijeet,

In a flat groupinggrid, you can get the selected records in this manner.

GridTable gt = this.gridGroupingControl1.Table;
foreach(SelectedRecord rec in gt.SelectedRecords)
{
Console.WriteLine(rec.Record);
}

With the nested tables, you need to get the child table you want, and do the same type of thing. Here is a code snippet

GridTable gt = this.gridGroupingControl1.GetTable("ChildTable");
foreach(SelectedRecord rec in gt.SelectedRecords)
{
Console.WriteLine(rec.Record);
}

Please refer to the attached sample for getting selected record in a grid.
GGC_NestedTable.zip

Best Regards,
Haneef

haneefm [Syncfusion]
Replied On August 27, 2007 08:07 PM

Hi Abhijeet,

Thanks for your interest in Syncfusion Products.

The information provided on this issue is not sufficient to trace out this problem. Please try to provide us some more information on this. Kindly provide us a minimal sample to reproduce the issue, this will help us to analyse the issue here and get back to you with the solution.

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.

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.

;