Get multiple selected record in GGC v 4.1.0.58 .Net 2003
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
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
SIGN IN To post a reply.
3 Replies
HA
haneefm
Syncfusion Team
August 14, 2007 03:27 PM UTC
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
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
AK
Abhijeet Kumar
August 16, 2007 08:56 AM UTC
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
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
HA
haneefm
Syncfusion Team
August 28, 2007 12:07 AM UTC
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
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
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
AK Abhijeet Kumar
- Aug 14, 2007 12:48 PM UTC
- Aug 28, 2007 12:07 AM UTC